1 # Filename: /etc/skel/.zshrc
2 # Purpose: config file for zsh (z shell)
3 # Authors: (c) grml-team (grml.org)
4 # Bug-Reports: see http://grml.org/bugs/
5 # License: This file is licensed under the GPL v2 or any later version.
6 ################################################################################
7 # Nowadays, grml's zsh setup lives in only *one* zshrc file.
8 # That is the global one: /etc/zsh/zshrc (from grml-etc-core).
9 # It is best to leave this file untouched and do personal changes to
10 # the setup via ${HOME}/.zshrc.local which is loaded at the end of the
13 # That way, we enable people on other operating systems to use our
14 # setup, too, just by copying our global zshrc to their ${HOME}/.zshrc.
15 # Adjustments would still go to the .zshrc.local file.
16 ################################################################################
18 ## Now, we'll give a few examples of what you might want to use in your
19 ## .zshrc.local file (just copy'n'paste and uncomment it there):
23 ## use the vi navigation keys (hjkl) besides cursor keys in menu completion
24 #bindkey -M menuselect 'h' vi-backward-char # left
25 #bindkey -M menuselect 'k' vi-up-line-or-history # up
26 #bindkey -M menuselect 'l' vi-forward-char # right
27 #bindkey -M menuselect 'j' vi-down-line-or-history # bottom
29 ## set command prediction from history, see 'man 1 zshcontrib'
30 #is4 && zrcautoload predict-on && \
31 #zle -N predict-on && \
32 #zle -N predict-off && \
33 #bindkey "^X^Z" predict-on && \
34 #bindkey "^Z" predict-off
36 ## press ctrl-q to quote line:
38 # zle beginning-of-line
40 # # RBUFFER="'$RBUFFER'"
41 # RBUFFER=${(q)RBUFFER}
44 #zle -N mquote && bindkey '^q' mquote
46 ## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
47 #WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
49 #WORDCHARS='*?_[]~=&;!#$%^(){}'
50 #WORDCHARS='${WORDCHARS:s@/@}'
53 ## some popular options ##
55 ## add `|' to output redirections in the history
56 #setopt histallowclobber
58 ## warning if file exists ('cat /dev/null > ~/.zshrc')
61 ## don't warn me about bg processes when exiting
64 ## alert me if something failed
65 #setopt printexitvalue
67 ## with spelling correction, assume dvorak kb
70 ## Allow comments even in interactive shells
71 #setopt interactivecomments
74 ## compsys related snippets ##
76 ## changed completer settings
77 #zstyle ':completion:*' completer _complete _correct _approximate
78 #zstyle ':completion:*' expand prefix suffix
80 ## another different completer setting: expand shell aliases
81 #zstyle ':completion:*' completer _expand_alias _complete _approximate
83 ## to have more convenient account completion, specify your logins:
85 # {grml,grml1}@foo.invalid
86 # grml-devel@bar.invalid
89 # {fred,root}@foo.invalid
92 #zstyle ':completion:*:my-accounts' users-hosts $my_accounts
93 #zstyle ':completion:*:other-accounts' users-hosts $other_accounts
95 ## telnet on non-default ports? ...well:
96 ## specify specific port/service settings:
97 #telnet_users_hosts_ports=(
100 # @mail-server:{smtp,pop3}
104 #zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
106 ## the default grml setup provides '..' as a completion. it does not provide
107 ## '.' though. If you want that too, use the following line:
108 #zstyle ':completion:*' special-dirs true
113 #alias u='translate -i'
115 ## ignore ~/.ssh/known_hosts entries
116 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
118 ## a variation of our man2 alias
119 #alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man'
122 ## global aliases (for those who like them) ##
124 #alias -g '...'='../..'
125 #alias -g '....'='../../..'
126 #alias -g BG='& exit'
130 #alias -g Hl=' --help |& less -r'
133 #alias -g LL='|& less -r'
135 #alias -g N='&>/dev/null'
136 #alias -g R='| tr A-z N-za-m'
137 #alias -g SL='| sort | less'
140 #alias -g V='| vim -'
142 ## miscellaneous code ##
144 ## Use a default width of 80 for manpages for more convenient reading
145 #export MANWIDTH=${MANWIDTH:-80}
147 ## Set a search path for the cd builtin
150 ## variations of our manzsh() function; pick you poison:
151 #manzsh() { /usr/bin/man zshall | most +/"$1" ; }
152 #[[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less'
153 #manzsh() { man zshall | $MYLESS -p $1 ; }
155 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
157 # NO_SWITCH="yes" command bash "$@"
160 # exec $SHELL $SHELL_ARGS "$@"
163 ## log out? set timeout in seconds...
164 ## ...and do not log out in some specific terminals:
165 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
171 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
172 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
173 #alias -s pl='perl -S'
175 ## ctrl-s will no longer freeze the terminal.
178 ## you want to automatically use a bigger font on big terminals?
179 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
183 ## Some quick Perl-hacks aka /useful/ oneliner
184 #bew() { perl -le 'print unpack "B*","'$1'"' }
185 #web() { perl -le 'print pack "B*","'$1'"' }
186 #hew() { perl -le 'print unpack "H*","'$1'"' }
187 #weh() { perl -le 'print pack "H*","'$1'"' }
188 #pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
189 #getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
190 #gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
191 #getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
192 #getforms () { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
193 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
194 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
195 #showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
196 #vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
197 #vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }