-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
191 lines (171 loc) · 5.96 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
# Lines configured by zsh-newuser-install
## Uncomment to profile the config
#zmodload zsh/zprof
# Set shell variables
## external plugins
# Create zsh folder and install plugins
if [[ ! -d $ZSH_PLUGINS_DIR ]]; then
mkdir -p $ZSH_PLUGINS_DIR
fi
if [[ ! -d $NVM_DIR ]]; then
mkdir -p $NVM_DIR
fi
if [[ ! -d $ZSH_PLUGINS_DIR/zsh-autosuggestions ]]; then
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_PLUGINS_DIR/zsh-autosuggestions
fi
if [[ ! -d $ZSH_PLUGINS_DIR/z ]]; then
git clone https://github.com/rupa/z.git $ZSH_PLUGINS_DIR/z
fi
if [[ ! -d $ZSH_PLUGINS_DIR/lean ]]; then
git clone https://github.com/miekg/lean.git $ZSH_PLUGINS_DIR/lean
fi
##Install tpm
if [[ ! -d $TMUX_PLUGINS_DIR/tpm ]]; then
git clone https://github.com/tmux-plugins/tpm $TMUX_PLUGINS_DIR/tpm
fi
# Source plugins
source $ZSH_PLUGINS_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH_PLUGINS_DIR/lean/lean.plugin.zsh
source $ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=3' ##Orangish
source $ZSH_PLUGINS_DIR/z/z.sh
## End of external plugins
## opt is case, symbol stripped
#
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename "$HOME/.zshrc"
# Manually added
## Source http://zshwiki.org/home/zle/bindkeys
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
bindkey -v
typeset -A key
key[Home]="$terminfo[khome]"
key[End]="$terminfo[kend]"
key[Insert]="$terminfo[kich1]"
key[Backspace]="$terminfo[kbs]"
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[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
[[ -n "$key[Delete]" ]] && bindkey -- "$key[Delete]" delete-char
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
[[ -n "$key[Left]" ]] && bindkey -- "$key[Left]" backward-char
[[ -n "$key[Right]" ]] && bindkey -- "$key[Right]" forward-char
# 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 () {
echoti smkx
}
function zle-line-finish () {
echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
autoload edit-command-line
zle -N edit-command-line
fi
## End Source zshwiki
## Source : Arch Wiki
#prompt walters
zstyle ':completion:*' menu select
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
## Src: https://dougblack.io/words/zsh-vi-mode.html
# Use vim cli mode
bindkey '^P' up-history
bindkey '^N' down-history
# backspace and ^h working even after
# returning from command mode
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
# ctrl-w removed word backwards
bindkey '^w' backward-kill-word
# ctrl-r starts searching history backward
bindkey '^r' history-incremental-search-backward
bindkey '^ ' forward-word
bindkey '^A' vi-beginning-of-line
bindkey '^E' vi-end-of-line
bindkey '^xe' edit-command-line
bindkey '^x^e' edit-command-line
KEYTIMEOUT=1
# Enable vim text Objects as shell functions
## src: https://www.reddit.com/r/vim/comments/4995nr/navigate_your_command_line_with_modal_vi/d0qmcbl?utm_source=share&utm_medium=web2x
#enable parens, quotes and surround text-objects
autoload -U select-bracketed
zle -N select-bracketed
for m in visual viopp; do
for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do
bindkey -M $m $c select-bracketed
done
done
autoload -U select-quoted
zle -N select-quoted
for m in visual viopp; do
for c in {a,i}{\',\",\`}; do
bindkey -M $m $c select-quoted
done
done
#autoload -Uz surround
#zle -N delete-surround surround
#zle -N change-surround surround
#zle -N add-surround surround
#bindkey -a cs change-surround
#bindkey -a ds delete-surround
#bindkey -a ys add-surround
#bindkey -M visual S add-surround
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
HISTORY_IGNORE='(docker ps *|(git|config) (restore --staged *|tag *|(checkout|co) *|tag *|show *|clone *|stash*|diff*|(status|st)|commit -m *|add *|log|log [^-]*)|nvim *|man *|mkdir *|mv *|rm *|ls*|f[g,c]|ssh [^-]*|echo *)'
setopt appendhistory hist_ignore_space hist_ignore_all_dups histsavenodups
setopt histsavenodups histignorespace
# asdf
if [[ -f $HOME/.asdf/asdf.sh ]]; then
. $HOME/.asdf/asdf.sh
fpath=(${ASDF_DIR}/completions $fpath)
fi
fpath=( ~/.config/zsh/functions "${fpath[@]}" )
autoload -Uz fzfdefaultopts
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
bindkey '^T' fzf-completion
bindkey '^I' $fzf_default_completion
fzfdefaultopts
## load individual config files
typeset -U config_files
config_files=($CONFIG_DIR/zsh/*.zsh)
# load config files
for file in ${config_files}
do
source $file
done
#if [ -z "$TMUX" ]; then
# tmux attach -t default || tmux new -s default
#fi
source $CONFIG_DIR/zsh/.aliases
autoload -Uz docker-start docker-stop
autoload -Uz compinit promptinit
autoload -Uz kubectl
compinit
promptinit
if [[ ! -d $ZSH_PLUGINS_DIR/zsh-syntax-highlighting ]]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_PLUGINS_DIR/zsh-syntax-highlighting
fi
## AWS CLI suggestions
autoload bashcompinit && bashcompinit
complete -C '/usr/local/bin/aws_completer' aws
source ~/.zshrc_others 2> /dev/null || true
source ~/.zshrc_colima 2> /dev/null || true