zshrc: provide .. as a completion
[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 ## 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
107
108 ## aliases ##
109
110 ## translate
111 #alias u='translate -i'
112
113 ## ignore ~/.ssh/known_hosts entries
114 #alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
115
116 ## a variation of our man2 alias
117 #alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man'
118
119
120 ## global aliases (for those who like them) ##
121
122 #alias -g '...'='../..'
123 #alias -g '....'='../../..'
124 #alias -g BG='& exit'
125 #alias -g C='|wc -l'
126 #alias -g G='|grep'
127 #alias -g H='|head'
128 #alias -g Hl=' --help |& less -r'
129 #alias -g K='|keep'
130 #alias -g L='|less'
131 #alias -g LL='|& less -r'
132 #alias -g M='|most'
133 #alias -g N='&>/dev/null'
134 #alias -g R='| tr A-z N-za-m'
135 #alias -g SL='| sort | less'
136 #alias -g S='| sort'
137 #alias -g T='|tail'
138 #alias -g V='| vim -'
139
140 ## miscellaneous code ##
141
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 ; }
146
147 ## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
148 #bash() {
149 #    NO_SWITCH="yes" command bash "$@"
150 #}
151 #restart () {
152 #    exec $SHELL $SHELL_ARGS "$@"
153 #}
154
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
158 #    unset TMOUT
159 #else
160 #    TMOUT=1800
161 #fi
162
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'
166
167 ## ctrl-s will no longer freeze the terminal.
168 #stty erase "^?"
169
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
172 #    large
173 #fi
174
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 *" }