Skip to content

Commit 1423a94

Browse files
committed
added zshrc
1 parent b535e88 commit 1423a94

1 file changed

Lines changed: 360 additions & 0 deletions

File tree

airootfs/etc/skel/.zshrc

Lines changed: 360 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,360 @@
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+
# your zsh setup via ${HOME}/.zshrc.local which is loaded at the end of
11+
# the 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+
## Inform users about upgrade path for grml's old zshrc layout, assuming that:
19+
## /etc/skel/.zshrc was installed as ~/.zshrc,
20+
## /etc/zsh/zshrc was installed as ~/.zshrc.global and
21+
## ~/.zshrc.local does not exist yet.
22+
if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
23+
printf '-!-\n'
24+
printf '-!- Looks like you are using the old zshrc layout of grml.\n'
25+
printf '-!- Please read the notes in the grml-zsh-refcard, being'
26+
printf '-!- available at: http://grml.org/zsh/\n'
27+
printf '-!-\n'
28+
printf '-!- If you just want to get rid of this warning message execute:\n'
29+
printf '-!- touch ~/.zshrc.local\n'
30+
printf '-!-\n'
31+
fi
32+
33+
## Settings for umask
34+
#if (( EUID == 0 )); then
35+
# umask 002
36+
#else
37+
# umask 022
38+
#fi
39+
40+
## Now, we'll give a few examples of what you might want to use in your
41+
## .zshrc.local file (just copy'n'paste and uncomment it there):
42+
43+
## Prompt theme extension ##
44+
45+
# Virtualenv support
46+
47+
#function virtual_env_prompt () {
48+
# REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
49+
#}
50+
#grml_theme_add_token virtual-env -f virtual_env_prompt '%F{magenta}' '%f'
51+
#zstyle ':prompt:grml:left:setup' items rc virtual-env change-root user at host path vcs percent
52+
53+
## ZLE tweaks ##
54+
55+
## use the vi navigation keys (hjkl) besides cursor keys in menu completion
56+
#bindkey -M menuselect 'h' vi-backward-char # left
57+
#bindkey -M menuselect 'k' vi-up-line-or-history # up
58+
#bindkey -M menuselect 'l' vi-forward-char # right
59+
#bindkey -M menuselect 'j' vi-down-line-or-history # bottom
60+
61+
## set command prediction from history, see 'man 1 zshcontrib'
62+
#is4 && zrcautoload predict-on && \
63+
#zle -N predict-on && \
64+
#zle -N predict-off && \
65+
#bindkey "^X^Z" predict-on && \
66+
#bindkey "^Z" predict-off
67+
68+
## press ctrl-q to quote line:
69+
#mquote () {
70+
# zle beginning-of-line
71+
# zle forward-word
72+
# # RBUFFER="'$RBUFFER'"
73+
# RBUFFER=${(q)RBUFFER}
74+
# zle end-of-line
75+
#}
76+
#zle -N mquote && bindkey '^q' mquote
77+
78+
## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
79+
#WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
80+
#WORDCHARS=.
81+
#WORDCHARS='*?_[]~=&;!#$%^(){}'
82+
#WORDCHARS='${WORDCHARS:s@/@}'
83+
84+
# just type '...' to get '../..'
85+
#rationalise-dot() {
86+
#local MATCH
87+
#if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then
88+
# LBUFFER+=/
89+
# zle self-insert
90+
# zle self-insert
91+
#else
92+
# zle self-insert
93+
#fi
94+
#}
95+
#zle -N rationalise-dot
96+
#bindkey . rationalise-dot
97+
## without this, typing a . aborts incremental history search
98+
#bindkey -M isearch . self-insert
99+
100+
#bindkey '\eq' push-line-or-edit
101+
102+
## some popular options ##
103+
104+
## add `|' to output redirections in the history
105+
#setopt histallowclobber
106+
107+
## try to avoid the 'zsh: no matches found...'
108+
#setopt nonomatch
109+
110+
## warning if file exists ('cat /dev/null > ~/.zshrc')
111+
#setopt NO_clobber
112+
113+
## don't warn me about bg processes when exiting
114+
#setopt nocheckjobs
115+
116+
## alert me if something failed
117+
#setopt printexitvalue
118+
119+
## with spelling correction, assume dvorak kb
120+
#setopt dvorak
121+
122+
## Allow comments even in interactive shells
123+
#setopt interactivecomments
124+
125+
## if a new command line being added to the history list duplicates an older
126+
## one, the older command is removed from the list
127+
#is4 && setopt histignorealldups
128+
129+
## compsys related snippets ##
130+
131+
## changed completer settings
132+
#zstyle ':completion:*' completer _complete _correct _approximate
133+
#zstyle ':completion:*' expand prefix suffix
134+
135+
## another different completer setting: expand shell aliases
136+
#zstyle ':completion:*' completer _expand_alias _complete _approximate
137+
138+
## to have more convenient account completion, specify your logins:
139+
#my_accounts=(
140+
# {grml,grml1}@foo.invalid
141+
142+
#)
143+
#other_accounts=(
144+
# {fred,root}@foo.invalid
145+
146+
#)
147+
#zstyle ':completion:*:my-accounts' users-hosts $my_accounts
148+
#zstyle ':completion:*:other-accounts' users-hosts $other_accounts
149+
150+
## add grml.org to your list of hosts
151+
#hosts+=(grml.org)
152+
#zstyle ':completion:*:hosts' hosts $hosts
153+
154+
## telnet on non-default ports? ...well:
155+
## specify specific port/service settings:
156+
#telnet_users_hosts_ports=(
157+
# user1@host1:
158+
# user2@host2:
159+
# @mail-server:{smtp,pop3}
160+
# @news-server:nntp
161+
# @proxy-server:8000
162+
#)
163+
#zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
164+
165+
## the default grml setup provides '..' as a completion. it does not provide
166+
## '.' though. If you want that too, use the following line:
167+
#zstyle ':completion:*' special-dirs true
168+
169+
## aliases ##
170+
171+
172+
#Display ISO version and distribution information in short
173+
alias version="sed -n 1p /etc/os-release && sed -n 11p /etc/os-release && sed -n 12p /etc/os-release"
174+
175+
#Pacman Shortcuts
176+
alias sync="sudo pacman -Syyy"
177+
alias install="sudo pacman -S"
178+
alias update="sudo pacman -Syyu"
179+
alias search="sudo pacman -Ss"
180+
alias search-local="sudo pacman -Qs"
181+
alias pkg-info="sudo pacman -Qi"
182+
alias local-install="sudo pacman -U"
183+
alias clr-cache="sudo pacman -Scc"
184+
alias unlock="sudo rm /var/lib/pacman/db.lck"
185+
alias remove="sudo pacman -R"
186+
alias autoremove="sudo pacman -Rns"
187+
188+
#Open files with root in nano
189+
alias sn="sudo nano"
190+
191+
192+
## translate
193+
#alias u='translate -i'
194+
195+
## ignore ~/.ssh/known_hosts entries
196+
#alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
197+
198+
199+
## global aliases (for those who like them) ##
200+
201+
#alias -g '...'='../..'
202+
#alias -g '....'='../../..'
203+
#alias -g BG='& exit'
204+
#alias -g C='|wc -l'
205+
#alias -g G='|grep'
206+
#alias -g H='|head'
207+
#alias -g Hl=' --help |& less -r'
208+
#alias -g K='|keep'
209+
#alias -g L='|less'
210+
#alias -g LL='|& less -r'
211+
#alias -g M='|most'
212+
#alias -g N='&>/dev/null'
213+
#alias -g R='| tr A-z N-za-m'
214+
#alias -g SL='| sort | less'
215+
#alias -g S='| sort'
216+
#alias -g T='|tail'
217+
#alias -g V='| vim -'
218+
219+
## instead of global aliase it might be better to use grmls $abk assoc array, whose contents are expanded after pressing ,.
220+
#$abk[SnL]="| sort -n | less"
221+
222+
## get top 10 shell commands:
223+
#alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
224+
225+
## Execute \kbd{./configure}
226+
#alias CO="./configure"
227+
228+
## Execute \kbd{./configure --help}
229+
#alias CH="./configure --help"
230+
231+
## miscellaneous code ##
232+
233+
## Use a default width of 80 for manpages for more convenient reading
234+
#export MANWIDTH=${MANWIDTH:-80}
235+
236+
## Set a search path for the cd builtin
237+
#cdpath=(.. ~)
238+
239+
## variation of our manzsh() function; pick you poison:
240+
#manzsh() { /usr/bin/man zshall | most +/"$1" ; }
241+
242+
## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
243+
#bash() {
244+
# NO_SWITCH="yes" command bash "$@"
245+
#}
246+
#restart () {
247+
# exec $SHELL $SHELL_ARGS "$@"
248+
#}
249+
250+
## Handy functions for use with the (e::) globbing qualifier (like nt)
251+
#contains() { grep -q "$*" $REPLY }
252+
#sameas() { diff -q "$*" $REPLY &>/dev/null }
253+
#ot () { [[ $REPLY -ot ${~1} ]] }
254+
255+
## get_ic() - queries imap servers for capabilities; real simple. no imaps
256+
#ic_get() {
257+
# emulate -L zsh
258+
# local port
259+
# if [[ ! -z $1 ]] ; then
260+
# port=${2:-143}
261+
# print "querying imap server on $1:${port}...\n";
262+
# print "a1 capability\na2 logout\n" | nc $1 ${port}
263+
# else
264+
# print "usage:\n $0 <imap-server> [port]"
265+
# fi
266+
#}
267+
268+
## List all occurrences of programm in current PATH
269+
#plap() {
270+
# emulate -L zsh
271+
# if [[ $# = 0 ]] ; then
272+
# echo "Usage: $0 program"
273+
# echo "Example: $0 zsh"
274+
# echo "Lists all occurrences of program in the current PATH."
275+
# else
276+
# ls -l ${^path}/*$1*(*N)
277+
# fi
278+
#}
279+
280+
## Find out which libs define a symbol
281+
#lcheck() {
282+
# if [[ -n "$1" ]] ; then
283+
# nm -go /usr/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"
284+
# else
285+
# echo "Usage: lcheck <function>" >&2
286+
# fi
287+
#}
288+
289+
## Download a file and display it locally
290+
#uopen() {
291+
# emulate -L zsh
292+
# if ! [[ -n "$1" ]] ; then
293+
# print "Usage: uopen \$URL/\$file">&2
294+
# return 1
295+
# else
296+
# FILE=$1
297+
# MIME=$(curl --head $FILE | \
298+
# grep Content-Type | \
299+
# cut -d ' ' -f 2 | \
300+
# cut -d\; -f 1)
301+
# MIME=${MIME%$'\r'}
302+
# curl $FILE | see ${MIME}:-
303+
# fi
304+
#}
305+
306+
## Memory overview
307+
#memusage() {
308+
# ps aux | awk '{if (NR > 1) print $5;
309+
# if (NR > 2) print "+"}
310+
# END { print "p" }' | dc
311+
#}
312+
313+
## print hex value of a number
314+
#hex() {
315+
# emulate -L zsh
316+
# if [[ -n "$1" ]]; then
317+
# printf "%x\n" $1
318+
# else
319+
# print 'Usage: hex <number-to-convert>'
320+
# return 1
321+
# fi
322+
#}
323+
324+
## log out? set timeout in seconds...
325+
## ...and do not log out in some specific terminals:
326+
#if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
327+
# unset TMOUT
328+
#else
329+
# TMOUT=1800
330+
#fi
331+
332+
## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
333+
#check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
334+
#alias -s pl='perl -S'
335+
336+
## ctrl-s will no longer freeze the terminal.
337+
#stty erase "^?"
338+
339+
## you want to automatically use a bigger font on big terminals?
340+
#if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
341+
# large
342+
#fi
343+
344+
## Some quick Perl-hacks aka /useful/ oneliner
345+
#bew() { perl -le 'print unpack "B*","'$1'"' }
346+
#web() { perl -le 'print pack "B*","'$1'"' }
347+
#hew() { perl -le 'print unpack "H*","'$1'"' }
348+
#weh() { perl -le 'print pack "H*","'$1'"' }
349+
#pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
350+
#getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
351+
#gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
352+
#getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
353+
#getforms () { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
354+
#getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
355+
#getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
356+
#showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
357+
#vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
358+
#vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }
359+
360+
## END OF FILE #################################################################

0 commit comments

Comments
 (0)