-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
198 lines (159 loc) · 4.12 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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# Arun Lakshmanan
# aliases {{{
alias ls='colorls --sd'
alias ll='colorls -lA --sd'
alias l='colorls -alt'
alias sudo='sudo '
alias tlmgr='env PATH="$PATH" tlmgr'
alias vi="nvim"
alias vim="nvim"
# }}}
# appearance {{{
# Uncomment following line if you want to disable command autocorrection
DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# vi completion
zstyle ':completion:*:*:vi:*:*files' ignored-patterns '*.o' '*.pyc'
zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*.o' '*.pyc'
zstyle ':completion:*:*:nvim:*:*files' ignored-patterns '*.o' '*.pyc'
# disable annoying beeps
unsetopt beep
unsetopt hist_beep
unsetopt list_beep
# autosuggest
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# }}}
# colorls {{{
source $(dirname $(gem which colorls))/tab_complete.sh
# }}}
# coreutils {{{
OSTYPE="$(uname -s)"
if [ "$OSTYPE" = "Darwin" ]; then
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
fi
# }}}
# history {{{
HISTFILE=$HOME/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space # ignore when commands starts with space
setopt share_history # share command history data
# }}}
# {{{ geometry
GEOMETRY_PROMPT_PLUGINS=(virtualenv git)
GEOMETRY_SYMBOL_PROMPT=""
GEOMETRY_COLOR_PROMPT="cyan"
GEOMETRY_SYMBOL_RPROMPT=""
GEOMETRY_SYMBOL_EXIT_VALUE="ﮊ"
GEOMETRY_COLOR_EXIT_VALUE="red"
GEOMETRY_SYMBOL_ROOT=""
GEOMETRY_COLOR_ROOT="magenta"
GEOMETRY_COLOR_DIR="cyan"
PROMPT_GEOMETRY_GIT_TIME=false
PROMPT_GEOMETRY_GIT_TIME_SHOW_EMPTY=false
PROMPT_GEOMETRY_GIT_SHOW_STASHES=false
# TODO: just colorize hostname on ssh
# PROMPT_GEOMETRY_COLORIZE_SYMBOL=true
# }}}
# texlive {{{
export PATH=/usr/local/texlive/2017/bin/x86_64-linux:$PATH
export INFOPATH=$INFOPATH:/usr/local/texlive/2017/texmf-dist/doc/info
export MANPATH=$MANPATH:/usr/local/texlive/2017/texmf-dist/doc/man
# }}}
# vi bindings {{{
export KEYTIMEOUT=20
bindkey -v
# Use jj for ESC
bindkey -M viins 'jj' vi-cmd-mode
# Use vim cli mode
bindkey '^j' up-history
bindkey '^k' down-history
# ctrl-w removed word backwards
bindkey '^w' backward-kill-word
# ctrl-r starts searching history backward
bindkey '^r' history-incremental-search-backward
# }}}
# zplug init {{{
source ~/.zplug/init.zsh
# }}}
# zplug packages {{{
zplug "geometry-zsh/geometry"
# zplug 'jedahan/geometry-hydrate', on:'geometry-zsh/geometry', defer:1
zplug "zsh-users/zsh-syntax-highlighting", defer:2
# }}}
# zplug load {{{
zplug "~/.zsh", from:local
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
zplug load
# }}}
# fzf {{{
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# }}}
# useful functions {{{
function update_apt {
echo "Updating apt"
sudo apt update -y
sudo apt upgrade -y
sudo apt autoremove
}
function update_brew {
echo "Updating brew"
brew update
brew upgrade
}
function update_gems {
echo "Updating gems"
sudo -H gem clean
sudo -H gem update
}
# find out which user installed packages need updating (except pip: https://github.com/pypa/pip/issues/5599)
function update_pip {
echo "Updating pip"
PIP_PKG_FILE=/tmp/pip_pkgs
pip list --user --outdated --format=freeze | grep -v 'pip' > $PIP_PKG_FILE
if [ -s $PIP_PKG_FILE ]; then
pip install --user -r $PIP_PKG_FILE --upgrade
else
echo "Already up-to-date"
fi
rm -f $PIP_PKG_FILE
}
function update_nvim {
echo "Updating nvim"
nvim +PlugClean +qall +silent
nvim +PlugUpdate +qall +silent
nvim +PlugUpgrade +qall +silent
}
function update_tmux {
echo "Updating tmux"
~/.tmux/plugins/tpm/bin/update_plugins all
}
function update_zplug {
echo "Updating zplug"
zplug clean
zplug update
}
function update {
if [ "$OSTYPE" = "Darwin" ]; then
update_brew
else
update_apt
fi
update_gems
update_pip
update_nvim
update_tmux
update_zplug
}
# }}}
# vim:foldmethod=marker:foldlevel=0