Add/Update header of /etc/skel/.zshrc and /etc/zsh/zshrc, add debian/NEWS entry
[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 # the setup via ${HOME}/.zshrc.local which is loaded at the end of the
11 # 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 ## 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):
20
21 ## ZLE tweaks ##
22
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
28
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
35
36 ## press ctrl-q to quote line:
37 #mquote () {
38 #      zle beginning-of-line
39 #      zle forward-word
40 #      # RBUFFER="'$RBUFFER'"
41 #      RBUFFER=${(q)RBUFFER}
42 #      zle end-of-line
43 #}
44 #zle -N mquote && bindkey '^q' mquote
45
46 ## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
47 #WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
48 #WORDCHARS=.
49 #WORDCHARS='*?_[]~=&;!#$%^(){}'
50 #WORDCHARS='${WORDCHARS:s@/@}'
51
52
53 ## some popular options ##
54
55 ## add `|' to output redirections in the history
56 #setopt histallowclobber
57
58 ## warning if file exists ('cat /dev/null > ~/.zshrc')
59 #setopt NO_clobber
60
61 ## don't warn me about bg processes when exiting
62 #setopt nocheckjobs
63
64 ## alert me if something failed
65 #setopt printexitvalue
66
67 ## with spelling correction, assume dvorak kb
68 #setopt dvorak
69
70 ## Allow comments even in interactive shells
71 #setopt interactivecomments
72
73
74 ## compsys related snippets ##
75
76 ## changed completer settings
77 #zstyle ':completion:*' completer _complete _correct _approximate
78 #zstyle ':completion:*' expand prefix suffix
79
80 ## another different completer setting: expand shell aliases
81 #zstyle ':completion:*' completer _expand_alias _complete _approximate
82
83 ## to have more convenient account completion, specify your logins:
84 #my_accounts=(
85 # {grml,grml1}@foo.invalid
86 # grml-devel@bar.invalid
87 #)
88 #other_accounts=(
89 # {fred,root}@foo.invalid
90 # vera@bar.invalid
91 #)
92 #zstyle ':completion:*:my-accounts' users-hosts $my_accounts
93 #zstyle ':completion:*:other-accounts' users-hosts $other_accounts
94
95 ## telnet on non-default ports? ...well:
96 ## specify specific port/service settings:
97 #telnet_users_hosts_ports=(
98 #  user1@host1:
99 #  user2@host2:
100 #  @mail-server:{smtp,pop3}
101 #  @news-server:nntp
102 #  @proxy-server:8000
103 #)
104 #zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
105
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
109
110 ## aliases ##
111
112 ## translate
113 #alias u='translate -i'
114
115 ## ignore ~/.ssh/known_hosts entries
116 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
117
118 ## a variation of our man2 alias
119 #alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man'
120
121
122 ## global aliases (for those who like them) ##
123
124 #alias -g '...'='../..'
125 #alias -g '....'='../../..'
126 #alias -g BG='& exit'
127 #alias -g C='|wc -l'
128 #alias -g G='|grep'
129 #alias -g H='|head'
130 #alias -g Hl=' --help |& less -r'
131 #alias -g K='|keep'
132 #alias -g L='|less'
133 #alias -g LL='|& less -r'
134 #alias -g M='|most'
135 #alias -g N='&>/dev/null'
136 #alias -g R='| tr A-z N-za-m'
137 #alias -g SL='| sort | less'
138 #alias -g S='| sort'
139 #alias -g T='|tail'
140 #alias -g V='| vim -'
141
142 ## miscellaneous code ##
143
144 ## Use a default width of 80 for manpages for more convenient reading
145 #export MANWIDTH=${MANWIDTH:-80}
146
147 ## Set a search path for the cd builtin
148 #cdpath=(.. ~)
149
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 ; }
154
155 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
156 #bash() {
157 #    NO_SWITCH="yes" command bash "$@"
158 #}
159 #restart () {
160 #    exec $SHELL $SHELL_ARGS "$@"
161 #}
162
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
166 #    unset TMOUT
167 #else
168 #    TMOUT=1800
169 #fi
170
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'
174
175 ## ctrl-s will no longer freeze the terminal.
176 #stty erase "^?"
177
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
180 #    large
181 #fi
182
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 *" }