56acc4253306a4cb2dfc741a011e67cd33fe7852
[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 ## a variation of our man2 alias
134 #alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man'
135
136
137 ## global aliases (for those who like them) ##
138
139 #alias -g '...'='../..'
140 #alias -g '....'='../../..'
141 #alias -g BG='& exit'
142 #alias -g C='|wc -l'
143 #alias -g G='|grep'
144 #alias -g H='|head'
145 #alias -g Hl=' --help |& less -r'
146 #alias -g K='|keep'
147 #alias -g L='|less'
148 #alias -g LL='|& less -r'
149 #alias -g M='|most'
150 #alias -g N='&>/dev/null'
151 #alias -g R='| tr A-z N-za-m'
152 #alias -g SL='| sort | less'
153 #alias -g S='| sort'
154 #alias -g T='|tail'
155 #alias -g V='| vim -'
156
157 ## miscellaneous code ##
158
159 ## Use a default width of 80 for manpages for more convenient reading
160 #export MANWIDTH=${MANWIDTH:-80}
161
162 ## Set a search path for the cd builtin
163 #cdpath=(.. ~)
164
165 ## variations of our manzsh() function; pick you poison:
166 #manzsh()  { /usr/bin/man zshall |  most +/"$1" ; }
167 #[[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less'
168 #manzsh()  { man zshall | $MYLESS -p $1 ; }
169
170 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
171 #bash() {
172 #    NO_SWITCH="yes" command bash "$@"
173 #}
174 #restart () {
175 #    exec $SHELL $SHELL_ARGS "$@"
176 #}
177
178 ## log out? set timeout in seconds...
179 ## ...and do not log out in some specific terminals:
180 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
181 #    unset TMOUT
182 #else
183 #    TMOUT=1800
184 #fi
185
186 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
187 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
188 #alias -s pl='perl -S'
189
190 ## ctrl-s will no longer freeze the terminal.
191 #stty erase "^?"
192
193 ## you want to automatically use a bigger font on big terminals?
194 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
195 #    large
196 #fi
197
198 ## Some quick Perl-hacks aka /useful/ oneliner
199 #bew() { perl -le 'print unpack "B*","'$1'"' }
200 #web() { perl -le 'print pack "B*","'$1'"' }
201 #hew() { perl -le 'print unpack "H*","'$1'"' }
202 #weh() { perl -le 'print pack "H*","'$1'"' }
203 #pversion()    { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
204 #getlinks ()   { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
205 #gethrefs ()   { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
206 #getanames ()  { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
207 #getforms ()   { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
208 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
209 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
210 #showINC ()    { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
211 #vimpm ()      { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
212 #vimhelp ()    { vim -c "help $1" -c on -c "au! VimEnter *" }
213
214 ## END OF FILE #################################################################