Beispiel .zshrc für eine "Gentooähnliche" Shell

Die zsh ist eine Linux/Unix-Shell, die als mächtigere alternative zur Bash gesehen werden kann. Gerade die Autocompletion von Kommandooptionen ist praktisch. Letzeres benötigt unter Gentoo das Paket app-shells/zsh-completion

brots .zshrc

# The following lines were added by compinstall

zstyle ':completion:*' completer _complete _ignored _approximate
zstyle :compinstall filename '/home/brot/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=5000
setopt appendhistory autocd extendedglob notify
bindkey -e
# End of lines configured by zsh-newuser-install

autoload -U promptinit
promptinit
prompt gentoo

alias emerge='emerge --jobs 4 --load-average 8 --keep-going'

# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key

key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}

# setup key accordingly
[[ -n "${key[Home]}"     ]]  && bindkey  "${key[Home]}"     beginning-of-line
[[ -n "${key[End]}"      ]]  && bindkey  "${key[End]}"      end-of-line
[[ -n "${key[Delete]}"   ]]  && bindkey  "${key[Delete]}"   delete-char
[[ -n "${key[PageUp]}"   ]]  && bindkey  "${key[PageUp]}"   history-beginning-search-backward
[[ -n "${key[PageDown]}" ]]  && bindkey  "${key[PageDown]}" history-beginning-search-forward

bindkey ';5D' emacs-backward-word
bindkey ';5C' emacs-forward-word

# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
function zle-line-init () {
    echoti smkx
}
function zle-line-finish () {
    echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish

Danach sieht die Shell ähnlich aus wie die gewohnte Gentoo-bash, und die gewohnten Sachen wie PgUp zur Suche in der history funktionieren. Quelle und weitere Informationen siehe das zshwiki.

brot_zshrc.txt · Last modified: 2012/04/15 17:49 by brot
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0