Skip to content

Instantly share code, notes, and snippets.

@nysalor
Created April 6, 2012 09:01
Show Gist options
  • Save nysalor/2318296 to your computer and use it in GitHub Desktop.
Save nysalor/2318296 to your computer and use it in GitHub Desktop.
zsh configuration
# color
autoload -Uz colors
colors
# left prompt
case ${UID} in
0)
PROMPT="# "
PROMPT2="%_# "
SPROMPT="%{${fg[red]}%r%} %{$reset_color%}is correct? [n,y,a,e]: "
;;
*)
PROMPT="%% "
PROMPT2="%_%% "
SPROMPT="%{${fg[red]}%r%} %{$reset_color%}is correct? [n,y,a,e]: "
;;
esac
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[green]}%}${HOST%%.*} %{$reset_color%}${PROMPT}"
# window title
case "${TERM}" in
kterm*|xterm)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
;;
esac
# history
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
# diretory
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
# comp
autoload -Uz compinit
compinit
zstyle :compinstall filename '~/.zshrc'
# autocorrect
setopt correct
# emacs like keybind
bindkey -e
# beep
setopt nolistbeep
setopt beep
set BEEP
# other settings
# search path
PATH=/usr/local/bin:$HOME/bin:/usr/local/mysql/bin:$PATH
# aliases
alias h history
# env
export PERL_BADLANG=0
export RSYNC_RSH=ssh
# umask
umask 022
# history inc.search
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
# right prompt
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
autoload -Uz is-at-least
if is-at-least 4.3.10; then
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "+"
zstyle ':vcs_info:git:*' unstagedstr "-"
zstyle ':vcs_info:git:*' formats '[%b[%c%u]]'
zstyle ':vcs_info:git:*' actionformats '[%b|%a[%c%u]]'
fi
function _update_vcs_info_msg() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
add-zsh-hook precmd _update_vcs_info_msg
RPROMPT="%1(v|%F{green}%1v%f|) [%20<..<%~]"
# personal settings
[ -f ~/local.zshrc ] && source ~/local.zshrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment