22869f7cf9a980e8690564a118d31be295a433a3
[grml-etc-core.git] / etc / skel / .zshrc
1 ## skel/.zshrc on grml systems
2 #
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
7 # global zshrc.
8 #
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.
12 #
13
14
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):
17
18
19 ## ZLE tweaks ##
20
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
26
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
33
34 ## press ctrl-q to quote line:
35 #mquote () {
36 #      zle beginning-of-line
37 #      zle forward-word
38 #      # RBUFFER="'$RBUFFER'"
39 #      RBUFFER=${(q)RBUFFER}
40 #      zle end-of-line
41 #}
42 #zle -N mquote && bindkey '^q' mquote
43
44 # define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
45 #  WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
46 #  WORDCHARS=.
47 #  WORDCHARS='*?_[]~=&;!#$%^(){}'
48 #  WORDCHARS='${WORDCHARS:s@/@}'
49
50
51 ## some popular options ##
52
53 ## add `|' to output redirections in the history
54 #setopt histallowclobber
55
56 ## warning if file exists ('cat /dev/null > ~/.zshrc')
57 #setopt NO_clobber
58
59 ## don't warn me about bg processes when exiting
60 #setopt nocheckjobs
61
62 ## alert me if something failed
63 #setopt printexitvalue
64
65 ## with spelling correction, assume dvorak kb
66 #setopt dvorak
67
68 ## Allow comments even in interactive shells
69 #setopt interactivecomments
70
71
72 ## compsys related snippets ##
73
74 ## changed completer settings
75 #zstyle ':completion:*' completer _complete _correct _approximate
76 #zstyle ':completion:*' expand prefix suffix
77
78 ## another different completer setting: expand shell aliases
79 #zstyle ':completion:*' completer _expand_alias _complete _approximate
80
81 ## to have more convenient account completion, specify your logins:
82 #my_accounts=(
83 # {grml,grml1}@foo.invalid
84 # grml-devel@bar.invalid
85 #)
86 #other_accounts=(
87 # {fred,root}@foo.invalid
88 # vera@bar.invalid
89 #)
90 #zstyle ':completion:*:my-accounts' users-hosts $my_accounts
91 #zstyle ':completion:*:other-accounts' users-hosts $other_accounts
92
93 ## telnet on non-default ports? ...well:
94 ## specify specific port/service settings:
95 #telnet_users_hosts_ports=(
96 #  user1@host1:
97 #  user2@host2:
98 #  @mail-server:{smtp,pop3}
99 #  @news-server:nntp
100 #  @proxy-server:8000
101 #)
102 #zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
103
104
105 ## aliases ##
106
107 ## translate
108 #alias u='translate -i'
109
110 ## ignore ~/.ssh/known_hosts entries
111 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
112
113 ## a variation of our man2 alias
114 #alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man'
115
116
117 ## global aliases (for those who like them) ##
118
119 #alias -g '...'='../..'
120 #alias -g '....'='../../..'
121 #alias -g BG='& exit'
122 #alias -g C='|wc -l'
123 #alias -g G='|grep'
124 #alias -g H='|head'
125 #alias -g Hl=' --help |& less -r'
126 #alias -g K='|keep'
127 #alias -g L='|less'
128 #alias -g LL='|& less -r'
129 #alias -g M='|most'
130 #alias -g N='&>/dev/null'
131 #alias -g R='| tr A-z N-za-m'
132 #alias -g SL='| sort | less'
133 #alias -g S='| sort'
134 #alias -g T='|tail'
135 #alias -g V='| vim -'
136
137 ## miscellaneous code ##
138
139 ## variations of our manzsh() function; pick you poison:
140 #manzsh()  { /usr/bin/man zshall |  most +/"$1" ; }
141 #[[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less'
142 #manzsh()  { man zshall | $MYLESS -p $1 ; }
143
144 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
145 #bash() {
146 #    NO_SWITCH="yes" command bash "$@"
147 #}
148 #restart () {
149 #    exec $SHELL $SHELL_ARGS "$@"
150 #}
151
152 ## log out? set timeout in seconds...
153 ## ...and do not log out in some specific terminals:
154 #if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
155 #    unset TMOUT
156 #else
157 #    TMOUT=1800
158 #fi
159
160 ## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
161 #check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
162 #alias -s pl='perl -S'
163
164 ## ctrl-s will no longer freeze the terminal.
165 #stty erase "^?"
166
167 ## you want to automatically use a bigger font on big terminals?
168 #if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
169 #    large
170 #fi
171
172 ## Some quick Perl-hacks aka /useful/ oneliner
173 #bew() { perl -le 'print unpack "B*","'$1'"' }
174 #web() { perl -le 'print pack "B*","'$1'"' }
175 #hew() { perl -le 'print unpack "H*","'$1'"' }
176 #weh() { perl -le 'print pack "H*","'$1'"' }
177 #pversion()    { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
178 #getlinks ()   { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
179 #gethrefs ()   { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
180 #getanames ()  { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
181 #getforms ()   { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
182 #getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
183 #getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
184 #showINC ()    { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
185 #vimpm ()      { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
186 #vimhelp ()    { vim -c "help $1" -c on -c "au! VimEnter *" }
187