0ccf8efb4f473c6a23479b0cb09a751b1aa68ff0
[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
68 ## some popular options ##
69
70 ## add `|' to output redirections in the history
71 #setopt histallowclobber
72
73 ## warning if file exists ('cat /dev/null > ~/.zshrc')
74 #setopt NO_clobber
75
76 ## don't warn me about bg processes when exiting
77 #setopt nocheckjobs
78
79 ## alert me if something failed
80 #setopt printexitvalue
81
82 ## with spelling correction, assume dvorak kb
83 #setopt dvorak
84
85 ## Allow comments even in interactive shells
86 #setopt interactivecomments
87
88
89 ## compsys related snippets ##
90
91 ## changed completer settings
92 #zstyle ':completion:*' completer _complete _correct _approximate
93 #zstyle ':completion:*' expand prefix suffix
94
95 ## another different completer setting: expand shell aliases
96 #zstyle ':completion:*' completer _expand_alias _complete _approximate
97
98 ## to have more convenient account completion, specify your logins:
99 #my_accounts=(
100 # {grml,grml1}@foo.invalid
101 # grml-devel@bar.invalid
102 #)
103 #other_accounts=(
104 # {fred,root}@foo.invalid
105 # vera@bar.invalid
106 #)
107 #zstyle ':completion:*:my-accounts' users-hosts $my_accounts
108 #zstyle ':completion:*:other-accounts' users-hosts $other_accounts
109
110 ## telnet on non-default ports? ...well:
111 ## specify specific port/service settings:
112 #telnet_users_hosts_ports=(
113 #  user1@host1:
114 #  user2@host2:
115 #  @mail-server:{smtp,pop3}
116 #  @news-server:nntp
117 #  @proxy-server:8000
118 #)
119 #zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
120
121 ## the default grml setup provides '..' as a completion. it does not provide
122 ## '.' though. If you want that too, use the following line:
123 #zstyle ':completion:*' special-dirs true
124
125 ## aliases ##
126
127 ## translate
128 #alias u='translate -i'
129
130 ## ignore ~/.ssh/known_hosts entries
131 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
132
133
134 ## global aliases (for those who like them) ##
135
136 #alias -g '...'='../..'
137 #alias -g '....'='../../..'
138 #alias -g BG='& exit'
139 #alias -g C='|wc -l'
140 #alias -g G='|grep'
141 #alias -g H='|head'
142 #alias -g Hl=' --help |& less -r'
143 #alias -g K='|keep'
144 #alias -g L='|less'
145 #alias -g LL='|& less -r'
146 #alias -g M='|most'
147 #alias -g N='&>/dev/null'
148 #alias -g R='| tr A-z N-za-m'
149 #alias -g SL='| sort | less'
150 #alias -g S='| sort'
151 #alias -g T='|tail'
152 #alias -g V='| vim -'
153
154 ## miscellaneous code ##
155
156 ## Use a default width of 80 for manpages for more convenient reading
157 #export MANWIDTH=${MANWIDTH:-80}
158
159 ## Set a search path for the cd builtin
160 #cdpath=(.. ~)
161
162 ## variation of our manzsh() function; pick you poison:
163 #manzsh()  { /usr/bin/man zshall |  most +/"$1" ; }
164
165 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
166 #bash() {
167 #    NO_SWITCH="yes" command bash "$@"
168 #}
169 #restart () {
170 #    exec $SHELL $SHELL_ARGS "$@"
171 #}
172
173 ## log out? set timeout in seconds...
174 ## ...and do not log out in some specific terminals:
175 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
176 #    unset TMOUT
177 #else
178 #    TMOUT=1800
179 #fi
180
181 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
182 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
183 #alias -s pl='perl -S'
184
185 ## ctrl-s will no longer freeze the terminal.
186 #stty erase "^?"
187
188 ## you want to automatically use a bigger font on big terminals?
189 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
190 #    large
191 #fi
192
193 ## Some quick Perl-hacks aka /useful/ oneliner
194 #bew() { perl -le 'print unpack "B*","'$1'"' }
195 #web() { perl -le 'print pack "B*","'$1'"' }
196 #hew() { perl -le 'print unpack "H*","'$1'"' }
197 #weh() { perl -le 'print pack "H*","'$1'"' }
198 #pversion()    { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
199 #getlinks ()   { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
200 #gethrefs ()   { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
201 #getanames ()  { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
202 #getforms ()   { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
203 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
204 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
205 #showINC ()    { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
206 #vimpm ()      { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
207 #vimhelp ()    { vim -c "help $1" -c on -c "au! VimEnter *" }
208
209 ## END OF FILE #################################################################