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