zshrc: move a commented out example to skel/.zshrc
[grml-etc-core.git] / etc / skel / .zshrc
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 # your zsh setup via ${HOME}/.zshrc.local which is loaded at the end of
11 # the global zshrc.
12 #
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 ################################################################################
17
18 ## Inform users about upgrade path for grml's old zshrc layout, assuming that:
19 ## /etc/skel/.zshrc was installed as ~/.zshrc,
20 ## /etc/zsh/zshrc was installed as ~/.zshrc.global and
21 ## ~/.zshrc.local does not exist yet.
22 if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
23     printf '-!-\n'
24     printf '-!- Looks like you are using the old zshrc layout of grml.\n'
25     printf '-!- Please read the notes in the grml-zsh-refcard, being'
26     printf '-!- available at: http://grml.org/zsh/\n'
27     printf '-!-\n'
28     printf '-!- If you just want to get rid of this warning message execute:\n'
29     printf '-!-        touch ~/.zshrc.local\n'
30     printf '-!-\n'
31 fi
32
33 ## Now, we'll give a few examples of what you might want to use in your
34 ## .zshrc.local file (just copy'n'paste and uncomment it there):
35
36 ## ZLE tweaks ##
37
38 ## use the vi navigation keys (hjkl) besides cursor keys in menu completion
39 #bindkey -M menuselect 'h' vi-backward-char        # left
40 #bindkey -M menuselect 'k' vi-up-line-or-history   # up
41 #bindkey -M menuselect 'l' vi-forward-char         # right
42 #bindkey -M menuselect 'j' vi-down-line-or-history # bottom
43
44 ## set command prediction from history, see 'man 1 zshcontrib'
45 #is4 && zrcautoload predict-on && \
46 #zle -N predict-on         && \
47 #zle -N predict-off        && \
48 #bindkey "^X^Z" predict-on && \
49 #bindkey "^Z" predict-off
50
51 ## press ctrl-q to quote line:
52 #mquote () {
53 #      zle beginning-of-line
54 #      zle forward-word
55 #      # RBUFFER="'$RBUFFER'"
56 #      RBUFFER=${(q)RBUFFER}
57 #      zle end-of-line
58 #}
59 #zle -N mquote && bindkey '^q' mquote
60
61 ## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
62 #WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
63 #WORDCHARS=.
64 #WORDCHARS='*?_[]~=&;!#$%^(){}'
65 #WORDCHARS='${WORDCHARS:s@/@}'
66
67 # just type 'cd ...' to get 'cd ../..'
68 #rationalise-dot() {
69 #  if [[ $LBUFFER == *.. ]] ; then
70 #    LBUFFER+=/..
71 #  else
72 #    LBUFFER+=.
73 #  fi
74 #}
75 #zle -N rationalise-dot
76 #bindkey . rationalise-dot
77
78 #bindkey '\eq' push-line-or-edit
79
80
81 ## some popular options ##
82
83 ## add `|' to output redirections in the history
84 #setopt histallowclobber
85
86 ## warning if file exists ('cat /dev/null > ~/.zshrc')
87 #setopt NO_clobber
88
89 ## don't warn me about bg processes when exiting
90 #setopt nocheckjobs
91
92 ## alert me if something failed
93 #setopt printexitvalue
94
95 ## with spelling correction, assume dvorak kb
96 #setopt dvorak
97
98 ## Allow comments even in interactive shells
99 #setopt interactivecomments
100
101
102 ## compsys related snippets ##
103
104 ## changed completer settings
105 #zstyle ':completion:*' completer _complete _correct _approximate
106 #zstyle ':completion:*' expand prefix suffix
107
108 ## another different completer setting: expand shell aliases
109 #zstyle ':completion:*' completer _expand_alias _complete _approximate
110
111 ## to have more convenient account completion, specify your logins:
112 #my_accounts=(
113 # {grml,grml1}@foo.invalid
114 # grml-devel@bar.invalid
115 #)
116 #other_accounts=(
117 # {fred,root}@foo.invalid
118 # vera@bar.invalid
119 #)
120 #zstyle ':completion:*:my-accounts' users-hosts $my_accounts
121 #zstyle ':completion:*:other-accounts' users-hosts $other_accounts
122
123 ## telnet on non-default ports? ...well:
124 ## specify specific port/service settings:
125 #telnet_users_hosts_ports=(
126 #  user1@host1:
127 #  user2@host2:
128 #  @mail-server:{smtp,pop3}
129 #  @news-server:nntp
130 #  @proxy-server:8000
131 #)
132 #zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
133
134 ## the default grml setup provides '..' as a completion. it does not provide
135 ## '.' though. If you want that too, use the following line:
136 #zstyle ':completion:*' special-dirs true
137
138 ## aliases ##
139
140 ## translate
141 #alias u='translate -i'
142
143 ## ignore ~/.ssh/known_hosts entries
144 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
145
146
147 ## global aliases (for those who like them) ##
148
149 #alias -g '...'='../..'
150 #alias -g '....'='../../..'
151 #alias -g BG='& exit'
152 #alias -g C='|wc -l'
153 #alias -g G='|grep'
154 #alias -g H='|head'
155 #alias -g Hl=' --help |& less -r'
156 #alias -g K='|keep'
157 #alias -g L='|less'
158 #alias -g LL='|& less -r'
159 #alias -g M='|most'
160 #alias -g N='&>/dev/null'
161 #alias -g R='| tr A-z N-za-m'
162 #alias -g SL='| sort | less'
163 #alias -g S='| sort'
164 #alias -g T='|tail'
165 #alias -g V='| vim -'
166
167 ## miscellaneous code ##
168
169 ## Use a default width of 80 for manpages for more convenient reading
170 #export MANWIDTH=${MANWIDTH:-80}
171
172 ## Set a search path for the cd builtin
173 #cdpath=(.. ~)
174
175 ## variation of our manzsh() function; pick you poison:
176 #manzsh()  { /usr/bin/man zshall |  most +/"$1" ; }
177
178 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
179 #bash() {
180 #    NO_SWITCH="yes" command bash "$@"
181 #}
182 #restart () {
183 #    exec $SHELL $SHELL_ARGS "$@"
184 #}
185
186 ## log out? set timeout in seconds...
187 ## ...and do not log out in some specific terminals:
188 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
189 #    unset TMOUT
190 #else
191 #    TMOUT=1800
192 #fi
193
194 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
195 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
196 #alias -s pl='perl -S'
197
198 ## ctrl-s will no longer freeze the terminal.
199 #stty erase "^?"
200
201 ## you want to automatically use a bigger font on big terminals?
202 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
203 #    large
204 #fi
205
206 ## Some quick Perl-hacks aka /useful/ oneliner
207 #bew() { perl -le 'print unpack "B*","'$1'"' }
208 #web() { perl -le 'print pack "B*","'$1'"' }
209 #hew() { perl -le 'print unpack "H*","'$1'"' }
210 #weh() { perl -le 'print pack "H*","'$1'"' }
211 #pversion()    { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
212 #getlinks ()   { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
213 #gethrefs ()   { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
214 #getanames ()  { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
215 #getforms ()   { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
216 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
217 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
218 #showINC ()    { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
219 #vimpm ()      { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
220 #vimhelp ()    { vim -c "help $1" -c on -c "au! VimEnter *" }
221
222 ## END OF FILE #################################################################