-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc.local
179 lines (148 loc) · 4.67 KB
/
.zshrc.local
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' squeeze-slashes true
zstyle :compinstall filename "$HOME/.zshrc"
bindkey -v
# End of lines configured by zsh-newuser-install
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
# Stuff from Arch Wiki
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
printf '%s' "${terminfo[smkx]}"
}
function zle-line-finish () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
fi
setopt autopushd pushdsilent pushdtohome
## This reverts the +/- operators.
setopt pushdminus
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias l='ls --color=auto'
alias ll='ls --color=auto -Ahl'
alias g='grep --color=auto'
alias h='history | grep'
alias sz='sudo -i zsh -l'
alias wg='wget --continue'
setopt histnostore histreduceblanks histsavenodups
autoload is-at-least
if is-at-least 5.3.0 $ZSH_VERSION
then
setopt incappendhistorytime
else
setopt incappendhistory
fi
# Search backwards and forwards with a pattern
bindkey -M vicmd '/' history-incremental-pattern-search-backward
bindkey -M vicmd '?' history-incremental-pattern-search-forward
# set up for insert mode too
bindkey -M viins '^R' history-incremental-search-backward
bindkey -M viins '^F' history-incremental-search-forward
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd e edit-command-line
# Help from Arch
(( $+aliases[run-help] )) && unalias run-help
autoload -U run-help
autoload run-help-git
alias help=run-help
ssht () {
ssh -t "$@" '$SHELL -lic byobu'
}
compdef _ssh_hosts ssht
bh () {
bash -c 'for i; do help $i | less -X; done' bash_help "$@"
}
dux () {
sudo du -hx --max-depth 1 "$@" | sort -h
}
# pip zsh completion start
function _pip_completion {
local words cword
read -Ac words
read -cn cword
reply=( $( COMP_WORDS="$words[*]" \
COMP_CWORD=$(( cword-1 )) \
PIP_AUTO_COMPLETE=1 $words[1] ) )
}
compctl -K _pip_completion pip
# pip zsh completion end
if [[ -n $COLORTERM ]]
then
case $TERM in
xterm*)
TERM=xterm-256color
;;
screen*)
TERM=screen-256color
;;
esac
fi
export TERM
export CDPATH="$CDPATH:$HOME:$HOME/dev"
export MANPAGER='vim --not-a-term +MANPAGER -'
export MANWIDTH=80
setopt BRACE_CCL
vup () (
cd
vim -c PlugUpgrade -c PlugUpdate -c qa
git submodule update --remote --init
)
if check_com -c pacman
then
alias up='pacu'
elif check_com -c apt-get && check_com -c apt
then
alias up='sudo apt update; sudo apt full-upgrade --autoremove --purge -y'
elif check_com -c apt-get
then
alias up='sudo apt-get update; sudo apt-get dist-upgrade --autoremove --purge -y'
elif check_com -c brew
then
alias up='brew upgrade; brew cleanup'
fi
zstyle ':prompt:grml:*:items:user' pre '%F{45}'
files=(
# /etc/profile.d/vte.sh
~/.zsh/f-sy-h/F-Sy-H.plugin.zsh
~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
~/.conflocal/$CONFLOCAL/.zshrc
)
for f in $files ; do
[[ -f $f ]] &&
. $f
done
fpath=(~/.zsh/completion $fpath)