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 ## variations of our manzsh() function; pick you poison:
143 #manzsh() { /usr/bin/man zshall | most +/"$1" ; }
144 #[[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less'
145 #manzsh() { man zshall | $MYLESS -p $1 ; }
147 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
149 # NO_SWITCH="yes" command bash "$@"
152 # exec $SHELL $SHELL_ARGS "$@"
155 ## log out? set timeout in seconds...
156 ## ...and do not log out in some specific terminals:
157 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
163 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
164 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
165 #alias -s pl='perl -S'
167 ## ctrl-s will no longer freeze the terminal.
170 ## you want to automatically use a bigger font on big terminals?
171 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
175 ## Some quick Perl-hacks aka /useful/ oneliner
176 #bew() { perl -le 'print unpack "B*","'$1'"' }
177 #web() { perl -le 'print pack "B*","'$1'"' }
178 #hew() { perl -le 'print unpack "H*","'$1'"' }
179 #weh() { perl -le 'print pack "H*","'$1'"' }
180 #pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
181 #getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
182 #gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
183 #getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
184 #getforms () { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
185 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
186 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
187 #showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
188 #vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
189 #vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }