I’ve been thinking about this for a while, but I was waiting to have a sufficiently nice ZSH configuration to publish it. After today’s mishap (running rm -Rf * in the root directory), I decided to finish it quickly. So here’s my configuration which can still be optimized, but is already very good for everyday use :-).
It works on Linux, Mac, BSD, and Windows (Cygwin).
The content of the files below may not be completely up-to-date. If you want my latest ZSH configuration, here’s my git repository address: https://www.deimos.fr/gitweb
#!/bin/zsh
# Version detectionZSH_VERSION_TYPE=old
if[[$ZSH_VERSION== 3.1.<6->* ||$ZSH_VERSION== 3.2.<->* ||$ZSH_VERSION== 4.<->* ]] ; thenif which zstyle > /dev/null ; thenZSH_VERSION_TYPE=new
fifi# Uname systemexportMYSYSTEM=`uname`# If you don't want history enter 1# Do not forget to delete ~/.zshhistoryexportNOHIST="0"# Using environnement filesfor envfile in ~/.zsh/* ; dotest -f $envfile&&source$envfiledone# Default Umaskumask022# Make default colorif[ -z "$nocolor"] ; then c6 && c2;
elsePS1="%n@%m %~ %% "export PS1
fi
#!/bin/zsh
set convert-meta off # Don't strip high bit when reading or displaying. set input-meta on
set output-meta on
set append history# multiple parallel zsh sessions will all have their history lists added to the history# No bipsunsetopt beep
unsetopt hist_beep
unsetopt list_beep
unsetopt ignore_eof # Logout Ctrl+Dsetopt chase_links # Properly handle symbolic linkssetopt hist_verify # Don't execute command when searching history with !setopt auto_list
setopt auto_cd # If command is invalid but matches a subdirectory name, execute 'cd subdirectory'setopt auto_remove_slash # When last character of completion is '/' and space is typed after, the '/' is deletedfunction common_terms (){ bindkey "\e[2~" quoted-insert
bindkey "\e[3~" delete-char
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
}# Make the Home, End, and Delete keys work on common terminals. if[["$TERM"=="linux"]] ; then common_terms
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
elif[["$TERM"=="rxvt"]] ; then common_terms
bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line
elif[["$TERM"== xterm* ]] ; then common_terms
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
fibindkey -s '^X^Z''%-^M'bindkey '^[e' expand-cmd-path
bindkey -s '^X?''\eb=\ef\C-x*'bindkey '^[^I' reverse-menu-complete
bindkey '^[p' history-beginning-search-backward
bindkey '^[n' history-beginning-search-forward
bindkey '^W'kill -region bindkey '^I' expand-or-complete-prefix
bindkey -s '^[[Z''\t'bindkey '^?' backward-delete-char
if which setterm > /dev/null ; then setterm -hbcolor bright white
setterm -ulcolor cyan
fi