-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrc.zsh
More file actions
193 lines (153 loc) · 5.05 KB
/
rc.zsh
File metadata and controls
193 lines (153 loc) · 5.05 KB
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
#!/usr/bin/env zsh
# begin profiling
# https://kev.inburke.com/kevin/profiling-zsh-startup-time/
PROFILE_STARTUP=false
if [[ "$PROFILE_STARTUP" == true ]]; then
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
PS4=$'%D{%M%S%.} %N:%i> '
exec 3>&2 2>$HOME/tmp/startlog.$$
setopt xtrace prompt_subst
fi
# end profiling (see also section at end)
# dedupe paths
typeset -gU cdpath fpath mailpath path
#path=(
#/usr/local/{bin,sbin}
#$path
#)
if (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi
#TMPPREFIX="${TMPDIR%/}/zsh"
# Highlighters {{{
# Declare the variable
typeset -A ZSH_HIGHLIGHT_STYLES
typeset -A ZSH_HIGHLIGHT_HIGHLIGHTERS # not according to documentation
# https://github.com/zsh-users/zsh-syntax-highlighting/tree/master/highlighters/main
# To differentiate aliases from other command types
ZSH_HIGHLIGHT_STYLES[comment]='fg=magenta,bold'
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor root line)
# }}}
source $HOME/.homesick/repos/runcom/rc.common
# homeshick completion needs to come before zsh compinit
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
# Tweak this value if necessary
export KEYTIMEOUT=20
# Fix esc behavior a la http://superuser.com/questions/516474/escape-not-idempotent-in-zshs-vi-emulation
noop () { }
zle -N noop
bindkey -M vicmd '\e' noop
# Allow octothorpe (#) prefixed comments
setopt -o interactivecomments
# History options
alias history='history 0' # make history show everything
export HISTFILE=~/.zsh_history
export HISTSIZE=20000
export SAVEHIST=20000
setopt share_history
# Disable Ctrl-D
set -o ignoreeof
# Allow redirect to overwrite existing files
setopt clobber
# Experimental candidates
#setopt AUTO_CD
setopt AUTO_PUSHD
setopt AUTO_NAME_DIRS
setopt GLOB_COMPLETE
setopt PUSHD_MINUS
setopt PUSHD_TO_HOME
setopt PUSHD_IGNORE_DUPS
setopt RM_STAR_WAIT
setopt ZLE
setopt EXTENDED_GLOB
# Antigen
# https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins-Overview
source $HOME/.homesick/repos/antigen/antigen.zsh
antigen bundle robbyrussell/oh-my-zsh lib/
antigen bundle git
antigen bundle Tarrasch/zsh-autoenv
antigen bundle gnu-utils
antigen bundle history-substring-search
antigen bundle lukechilds/zsh-better-npm-completion
antigen bundle colored-man-pages
antigen bundle colorize
antigen bundle docker
antigen bundle node
antigen bundle pip
antigen bundle python
antigen bundle vagrant
#antigen bundle extract # x swiss army knife
#antigen bundle felixr/docker-zsh-completion
#antigen bundle gitignore
#antigen bundle gpg-agent
#antigen bundle mvn
#antigen bundle npm
#antigen bundle rupa/z
#antigen bundle srijanshetty/zsh-pip-completion
#antigen bundle ssh-agent
#antigen bundle tmux
#antigen bundle vi-mode
#antigen bundle virtualenv
#antigen bundle web-search
# System-specific tweaks
if [[ $system == 'OSX' ]]; then
antigen bundle brew
antigen bundle brew-cask
# antigen bundle osx
elif [[ $system == 'Linux' ]]; then
# pass
elif [[ $system == 'Cygwin' ]]; then
antigen bundle cygwin
fi
antigen theme romkatv/powerlevel10k
antigen bundle zsh-users/zsh-completions
# https://github.com/zsh-users/zsh-autosuggestions/issues/296
if [[ $(zsh --version | awk '{print $2}') > 5.0.8 ]]; then
antigen bundle zsh-users/zsh-autosuggestions
fi
# zsh-syntax-highlighting should be at end of .zshrc, according to instructions
antigen bundle zsh-users/zsh-syntax-highlighting
# Apply antigen configuration
antigen apply
# Global zsh key bindings
bindkey "^?" backward-delete-char
bindkey "^W" backward-kill-word
bindkey "^H" backward-delete-char # Control-h also deletes the previous char
bindkey "^U" kill-line
bindkey -M viins "^R" history-incremental-search-backward
bindkey -M viins "^P" history-substring-search-up
bindkey -M viins "^N" history-substring-search-down
bindkey -M viins "jk" vi-cmd-mode
bindkey -M viins " " magic-space
bindkey -M vicmd "/" history-incremental-search-backward
bindkey -M vicmd "?" history-incremental-search-forward
bindkey -M vicmd "q" push-line
# Source more common setup
source $HOME/.homesick/repos/runcom/rc.common-post
# Setup right prompt
#setopt prompt_subst
#export RPROMPT='$RUNCOM_TODO_CONTEXT'
#export RPROMPT='$([ -f ~/.runcom-rprompt ] && cat ~/.runcom-rprompt) $RUNCOM_TODO_CONTEXT'
#export DISABLE_AUTO_TITLE="true"
# FIXME: Ugly hack: rebind(?) to vi keys (did not need to, previously)
bindkey -v
# FIXME: Probably set by some bundle; disable this properly instead
unsetopt auto_cd
# Command-line Fuzzy Finder
# Note: if this line is moved above source rc.common-post, hocd completions
# (and possibly others) stop working in OSX.
if [ -f "$HOME/.fzf/shell/completion.zsh" ]; then
source "$HOME/.fzf/shell/completion.zsh"
fi
if [ -f "$HOME/.fzf/shell/key-bindings.zsh" ]; then
source "$HOME/.fzf/shell/key-bindings.zsh"
fi
# Powerline 10k - fast customized prompt.
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
# cleanup profiling
#if [[ "$PROFILE_STARTUP" == true ]]; then
#unsetopt xtrace
#exec 2>&3 3>&-
#fi
# end cleanup profiling