-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
171 lines (140 loc) · 4.17 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
autoload -U colors && colors
autoload -U promptinit && promptinit
# # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcomplist-Module
# # no idea why this doesn't work
# zmodload zsh/complist
# autoload -Uz complist && complist
# The following lines were added by compinstall
zstyle ':completion:*' auto-description 'specify %d'
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]}' '+r:|[._-]=** r:|=**' '+l:|=* r:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' original false
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/Users/libc/.zshrc'
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=$HOME/.history
HISTSIZE=10000
SAVEHIST=100000
setopt autocd extendedglob
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# prompt {{{1
# red prompt for normal mode, cribbed from SO
bindkey -v
function zle-line-init zle-keymap-select {
case ${KEYMAP} in
(vicmd) PROMPT=$'%{\e[0;31m%}%#%{\e[0m%} ' ;;
(main|viins) PROMPT=$'%# ' ;;
(*) PROMPT=$'%# ' ;;
esac
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# }}}
# aliases {{{1
ZSHRC=$HOME/.zshrc
export ALIASES=$HOME/.aliases
export AUTO_ALIASES=$ALIASES/auto
# edit this file and source it
alias vizsh="vim $ZSHRC && source $ZSHRC"
# add an alias
# ALIASES/AUTO_ALIASES are defined in .zshenv
aaa () {
echo "alias $1=\"$2\"" >> $AUTO_ALIASES
source $AUTO_ALIASES
which $1
}
# add a bunch of aliases
vialiases () {
(cd $ALIASES
vim
)
for file in $(find $ALIASES -follow); do source $file; done
}
# alias completions {{{2
# can't put these in .aliases since we might not have completion while sourcing
# it from .zshenv
function _cco {
_values \
"cco" $(glast)
}
compdef _cco cco
# zsh ships with nice git completions, see
# /usr/share/zsh/5.3/functions/_git
compdef _git-checkout mb
# need a better way to do compdef for your own scripts
function _gmail {
_values \
"gmail" $(gmail --completions)
}
compdef _gmail gmail
# }}}
# }}}
# setopts {{{1
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt HIST_FIND_NO_DUPS
setopt HIST_EXPIRE_DUPS_FIRST
setopt ALWAYS_TO_END
setopt AUTO_NAME_DIRS
setopt AUTO_PUSHD
setopt NO_BEEP
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_VERIFY
# clear rprompt on new commands, thank god for this
setopt TRANSIENTRPROMPT
# }}}
# defaults {{{1
export EDITOR=vim
export LESS="-iFRX"
# colorize ls
export CLICOLOR=1
# }}}
# path munging {{{1
export PATH="$HOME/bin:$PATH"
# }}}
# plugins {{{{1
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOME/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
# }}}
# bindkeys {{{1
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^H' backward-delete-char
# obsoleted by history-substring-search
# bindkey "^[[A" history-beginning-search-backward
# bindkey "^[[B" history-beginning-search-forward
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down
# override default history-beginning-search-x
bindkey -M vicmd 'j' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey '^E' autosuggest-accept
# :nmap <Space> i
bindkey -M vicmd ' ' vi-insert
bindkey "^R" history-incremental-search-backward
bindkey "^T" push-line-or-edit
# }}}
# source os/machine/company-specific files
export EXTRAS=$HOME/.zshrc_extra
for file in $(find $EXTRAS -follow); do source $file; done
# vim:foldmethod=marker
# vim:noet:sw=2:ts=2