Skip to content

Latest commit

 

History

History
193 lines (147 loc) · 5.07 KB

zsh.org

File metadata and controls

193 lines (147 loc) · 5.07 KB

zsh

Oh-my-zsh

Path to oh-my-zsh configuration

ZSH=$HOME/.oh-my-zsh

Theme

ZSH_THEME="robbyrussell"

Plugins

plugins=(git)

Load oh-my-zsh

source $ZSH/oh-my-zsh.sh

History

export HISTSIZE=1000
export SAVEHIST=1000
export HISTFILE=~/.history

User binaries

export PATH=$PATH:$HOME/bin

zsh prompt

Old prompt

autoload -U colors && colors
export PROMPT=%F{blue}\[%f%B%F{green}%~%f%b%F{blue}\]%f\

term

TERM=xterm

Aliases

alias ls='ls --color'
alias -g G='| grep'
alias stamp='git commit -m "`date`"'
alias e='emacsclient -n'
alias guard='grails -reloading -echoOut test-app guard:'
alias pt='py.test --tb=native'

Java

export JAVA_HOME=/usr/local/opt/java/current
export PATH=$PATH:$JAVA_HOME/bin
export JAVA_OPTS=-Xmx8192M

GVM

[[ -s "$HOME/.gvm/bin/gvm-init.sh" ]] && source "$HOME/.gvm/bin/gvm-init.sh"

Cask

export PATH=$PATH:~/.cask/bin

Python

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=`which python3`

source `which virtualenvwrapper.sh`

Keychain

Script that runs keychain loading all the private keys starting with id_

function find_private_ssh_keys() {
    find ~/.ssh -type f -name "id_*" -not -name "*.pub"
}

KEYS=`find_private_ssh_keys`

eval `keychain --quiet --eval --agents ssh $KEYS`

Source files

zsh source files loading process

for file in ~/.zsh/*.zsh; do
    source $file
done

Custom functions

modernize

function modernize() {
    sudo apt-get update
    sudo apt-get dist-upgrade -y
    gvm selfupdate
    upgrade_oh_my_zsh
}

Set custom keyboard map

function custom_keyboard_map() {
     setxkbmap -layout us,es -variant altgr-intl, -option grp:alt_space_toggle -option grp_led:caps -option ctrl:nocaps
}

Tmux, connect or create session

function is_tmux_running() {
    tmux ls > /dev/null 2>&1
    echo $?
}

function tmux_connect_or_create_session() {
    # If we are not inside of a TMUX and are in a graphical session
    if [[ -z "$TMUX" ]] && [[ -n "$DISPLAY" ]]
    then
        # If we have a tmux session running
        if [[ `is_tmux_running` -eq 0 ]]
        then
            tmux at
        else
            tmux
        fi
    fi
}

We want to execute this function when the shell loads, so we need to include it after the .zsh files execution in the main .zshrc file:

tmux_connect_or_create_session

Private functions

-----BEGIN PGP MESSAGE----- Version: GnuPG v2.0.22 (GNU/Linux)

hQIOA50twMi6CP1pEAgAnS+y7H9DRxd46RdVHpvl0ANL5S8HsDcugCgGZYP2R1mS I0++pc6Pfnga4v2Nzoos1pNbPFfwufcEQT+hw9XJRJ4DMsHkIrNTy73EQ3jf7X3W 6vZXCmmmd9yDrTsYbinrzPzA1r2dVUUuHqB1m4IXtdBV8skXHxG/bIBh63/DzuR3 5FYmXUAdterLp79n4SgZjQtCD7TBTsgSAGLTMd6urs9UmXSK8G/JKwA3UA0n1nn2 lTei4rmi8WW4wtkb5Ck6+HqS7uYIlT+j2BIG0o7p3NcsxAx1YluGtWSiZVHqCfMZ RGPBzqESy8xyjjj09VUS08Z3n5yyYAXXaX9ortDO+Af6AwYm6JUSVvdujZK1OQw9 dhpiCnjOhweOiJGl+3BciPUFT8DKUThDe+0Tpv01KDGgDdg70NUAZ95J2WqQyF66 pNa6BtxbGmwXo9InYEooC7qb0aySGMvjYo44Vw1efk5iRdv7AFrSpbI6B5/HsiYx rM51LFI6niFAtnrUQ4devtbT6nreSri1b3EeZv8CMwmDJiuZxAUAQCIOWmgAN08L yYIsEr5lVaGcIR9NlB/+UmTq+d2OF2SYfAPwyAisteqPc7ZoYczgy6CXa7kXPkrb 0nu1eJZQgS12kpr/TGr8o+P4qYkBo7dhEF6beThr4aP6fwsJVgzpZ/UOxqruL6n1 W9K/AfTS+XhZuU1PdvXuB1GZOd7FhaYHU7f7xPFRQLJamSTp4dUTtr5jytPS14NI CPY2Isff1bRyEbyBfgIQyzlKk62F7oTNzpEGRyr9hEfX/gfu8jS2vDFwhP7EKjCj DuoigusChBtcgUEPlQX7AyyaJ9eT+/5YlBN070PU6kw199/Ch0JvRUINWRS8eqew brnE7F3TbKfnYyyBP7n/vi89nDgzreKOpOJLFrtGKg9mLsT63wQgDdzdJPExO8TM D08= =/SAm -----END PGP MESSAGE-----