Skip to content

Instantly share code, notes, and snippets.

@jorge-lavin
Last active August 29, 2015 14:19
Show Gist options
  • Save jorge-lavin/f41480c10fa1a56355ee to your computer and use it in GitHub Desktop.
Save jorge-lavin/f41480c10fa1a56355ee to your computer and use it in GitHub Desktop.
#
# .zshrc is sourced in interactive shells.
# It should contain commands to set up aliases,
# functions, options, key bindings, etc.
#
autoload -U compinit
compinit
#allow tab completion in the middle of a word
setopt COMPLETE_IN_WORD
## history
#setopt APPEND_HISTORY
## for sharing history between zsh processes
#setopt INC_APPEND_HISTORY
#setopt SHARE_HISTORY
## never ever beep ever
setopt NO_BEEP
autoload -U colors
colors
# machine specifics
source $HOME/.localinclude
# because I like learning walls
export EDITOR=VIM
# aliases
alias ez='vim $HOME/.zshrc'
alias sz='source $HOME/.zshrc'
# custom path
# this funcion adds a folder to the path if its not already present
local pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
pathadd $HOME/bin
pathadd $CLIENT_INSTALLER_HOME/NSH/bin
# Insert "sudo " at the beginning of the line
function prepend-sudo {
if [[ $BUFFER != "sudo "* ]]; then
BUFFER="sudo $BUFFER"; CURSOR+=5
fi
}
zle -N prepend-sudo && bindkey "^[s" prepend-sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment