-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_zshrc
executable file
·147 lines (108 loc) · 3.35 KB
/
_zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# zsh setopts {{{
setopt correct
setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flow_control
setopt auto_cd
setopt cdable_vars
setopt auto_name_dirs
setopt auto_pushd
setopt pushd_ignore_dups
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt hist_find_no_dups
setopt hist_reduce_blanks
setopt inc_append_history
setopt share_history # share command history data
setopt interactive_comments
setopt long_list_jobs
setopt no_hup
setopt no_mail_warning
# }}}
# autoloads {{{
autoload -U colors && colors
autoload -U compinit && compinit -i
autoload -U zcalc
# edit the commandline
autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line
# smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# setup defaults for alias -s
autoload -U zsh-mime-setup
zsh-mime-setup
# }}}
# Completion {{{
WORDCHARS=''
zmodload -i zsh/complist
zstyle ':completion:*' \
matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' \
list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' \
command "ps -u$USER -o pid,user,comm -w -w"
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' \
tag-order local-directories directory-stack path-directories
# Use caching to speed things up
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ${HOME}/.cache/zsh
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
avahi bin daemon dbus ftp git http mail mpd mysql nobody ntp \
polkitd postfix postgres root rtkit transmission usbmux uuidd
# ... unless we really want to.
zstyle '*' single-ignored show
# }}}
# extra files {{{
# aliases and functions global for all shells
for file in ".aliases" ".functions" ".zlerc" ; do
[ -r "$HOME/$file" ] && . "$HOME/$file"
done
# command-not-found hook
[ -r "/usr/share/doc/pkgfile/command-not-found.zsh" ] \
&& . /usr/share/doc/pkgfile/command-not-found.zsh
# }}}
# functions {{{
function history() {
builtin history ${@:-1}
}
function source() {
builtin source ${@:-"${HOME}/.zshrc"}
}
function stats() {
local ignored=".\/|clear|tmux" # keep something in here
fc -nl 1 \
| awk '$1!~/'"$ignored"'/ {
CMD[$1]++;
} END {
for (a in CMD) print CMD[a] " " a;
}'\
| sort -nr | head -n ${1:-10} | column -c3 -t | nl
}
+vi-git-untracked() {
git rev-parse --is-inside-work-tree &> /dev/null || return;
git status --porcelain | grep '??' &> /dev/null || return;
hook_com[unstaged]+='T'
}
alias k='fc -e -'
# }}}
if [ -f "$HOME/.zshrc.local" ]; then
source "$HOME/.zshrc.local"
fi
# prompt {{{
which prompt >/dev/null 2>&1 && prompt off
[[ -e $HOME/.zpromptrc ]] && . $HOME/.zpromptrc
# }}}
export MAILCHECK=0
# vim:foldenable:ft=zsh