This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.zshrc
executable file
·214 lines (183 loc) · 6.94 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/usr/bin/env zsh
#--------------------------------------------------------------------------------------------------------------------
###WAL COLORS
(cat ~/.cache/wal/sequences &)
source ~/.cache/wal/colors.sh
#--------------------------------------------------------------------------------------------------------------------
###SCRIPTS PATH
export FPATH=~/.config/zsh:$FPATH
###FUNCTIONS
[ -d ~/.func ] && for file in ~/.func/*; do source "$file" ; done
###PROFILE
[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
###DIRENV
eval "$(direnv hook zsh)"
###MODULES
[[ -e /opt/modules ]] && source /opt/modules/init/zsh
###LAUNCHER
if [[ -n ${LAUNCHER} ]]; then
PS1="> "
bindkey -s "^M" " & \n"
bind 'RETURN: "\e[4~ & \n exit \n"'
return
fi
###CASE INSENSITIVE
zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# treat `#', `~' and `^' characters as part of patterns for filename generation
setopt extended_glob
setopt local_options
# case insensitive matching when performing filename expansion
setopt no_case_glob
# if command not found, but directory found, cd into this directory
setopt auto_cd
# turn off automatic matching of ~/ directories (speeds things up)
setopt no_cdable_vars
# prevents you from accidentally overwriting an existing file
setopt clobber
# perform implicit tees or cats when multiple redirections are attempted
setopt multios
# do not send the HUP signal to backround jobs on shell exit
setopt no_hup
# parameter expansion, command substitution and arithmetic expansion are performed in prompts
setopt prompt_subst
# do not prompt when rm *
setopt rmstarsilent
#--------------------------------------------------------------------------------------------------------------------
###HISTORY STAFF
export HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
HISTFILE=~/.config/zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt append_history
setopt sharehistory
setopt incappendhistory
setopt inc_append_history
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt hist_ignore_space
setopt interactive_comments
setopt no_beep
#--------------------------------------------------------------------------------------------------------------------
###VI MODE
bindkey -v
DEFAULT_VI_MODE=viins
KEYTIMEOUT=1
set_vi_mode_cursor() {
case $KEYMAP in
vicmd)
printf "\033[2 q"
;;
main|viins)
printf "\033[3 q"
;;
esac
}
zle-keymap-select(){ set_vi_mode_cursor; zle reset-prompt; }
zle-line-init(){ zle -K $DEFAULT_VI_MODE; }
zle -N zle-line-init
zle -N zle-keymap-select
vi-append-x-selection(){ RBUFFER=$(xsel -o -p </dev/null)$RBUFFER; }
zle -N vi-append-x-selection
bindkey -M vicmd '^P' vi-append-x-selection
vi-yank-x-selection(){ print -rn -- $CUTBUFFER | xsel -i -p; }
zle -N vi-yank-x-selection
bindkey -M vicmd '^Y' vi-yank-x-selection
#--------------------------------------------------------------------------------------------------------------------
# use SUDO for last command
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
if [[ $BUFFER == sudo\ * ]]; then
LBUFFER="${LBUFFER#sudo }"
elif [[ $BUFFER == $EDITOR\ * ]]; then
LBUFFER="${LBUFFER#$EDITOR }"
LBUFFER="sudoedit $LBUFFER"
elif [[ $BUFFER == sudoedit\ * ]]; then
LBUFFER="${LBUFFER#sudoedit }"
LBUFFER="$EDITOR $LBUFFER"
else
LBUFFER="sudo $LBUFFER"
fi
}
zle -N sudo-command-line
bindkey -s '\es' sudo-command-line
#-------------------------------------------------------------------------------------------------------------------
###SEPARATOR LINES
hrrrr() {
if (( COLS <= 0 )) ; then
COLS="${COLUMNS:-80}"
fi
local WORD="$1"
if [[ -n "$WORD" ]] ; then
local LINE=''
while (( ${#LINE} < COLS ))
do
LINE="$LINE$WORD"
done
echo "${LINE:0:$COLS}"
fi
}
function precmd() { hrrrr '-'; }
#--------------------------------------------------------------------------------------------------------------------
###FUZZYFINDER
function run_history(){ hister; zle reset-prompt; zle redisplay; }
zle -N run_history
bindkey -M vicmd '^t' run_history
bindkey -M viins '^t' run_history
bindkey '^t' run_history
function run_killer(){ killer; zle reset-prompt; zle redisplay; }
zle -N run_killer
bindkey -M vicmd '^k' run_killer
bindkey -M viins '^k' run_killer
bindkey '^k' run_killer
function run_find(){ finder; zle reset-prompt; zle redisplay; }
zle -N run_find
bindkey -M vicmd '^f' run_find
bindkey -M viins '^f' run_find
bindkey '^f' run_find
function run_compile(){ compile FastDebug && build; zle reset-prompt; zle redisplay; }
zle -N run_compile
bindkey -M viins '^o' run_compile
bindkey -M vicmd '^o' run_compile
bindkey '^o' run_compile
push-line-and-clear() { zle .push-line; zle .clear-screen }
zle -N push-line-and-clear
bindkey '^L' push-line-and-clear
#--------------------------------------------------------------------------------------------------------------------
###MODULES
autoload -U colors && colors
autoload compinit && compinit
# TMOUT=1
TRAPALRM() {
if [ "$WIDGET" != "complete-word" ]; then
zle reset-prompt
fi
}
[ -d ~/.config/zsh/insult ] && . ~/.config/zsh/insult
[ -f ~/.config/zsh/async ] && autoload -U async
[ -d ~/.config/zsh/cmdtime ] && source ~/.config/zsh/cmdtime/zsh-command-time.zsh
[ -d ~/.config/zsh/visualvi ] && source ~/.config/zsh/visualvi/zsh-vimode-visual.zsh
[ -d ~/.config/zsh/autosuggestions ] && source ~/.config/zsh/autosuggestions/zsh-autosuggestions.zsh
[ -d ~/.config/zsh/syntax ] && source ~/.config/zsh/syntax/zsh-syntax-highlighting.zsh
#[ -d ~/.config/zsh/almostontop ] && source ~/.config/zsh/almostontop/almostontop.plugin.zsh
[ -d ~/.config/zsh/upsearch ] && source ~/.config/zsh/upsearch/zsh-history-substring-search.zsh
[ -d ~/.config/zsh/upsearch ] && source ~/.config/zsh/upsearch/zsh-miscellaneous.zsh
[ -d ~/.config/zsh/autopair ] && source ~/.config//zsh/autopair/autopair.zh
[ -d ~/.config/zsh/completions ] && source ~/.config/zsh/completions/zsh-completions.zsh
[ -d ~/.config/zsh/goto ] && source ~/.config/zsh/goto/goto.sh
[ -d ~/.config/gitstatus ] && source ~/.config/gitstatus/gitstatus.prompt.zsh
#--------------------------------------------------------------------------------------------------------------------
###THEME
[ -f ~/.config/promptline ] && source ~/.config/promptline
#--------------------------------------------------------------------------------------------------------------------
# Added by Zplugin's installer
# source "$HOME/.zplugin/bin/zplugin.zsh"
# autoload -Uz _zplugin
# (( ${+_comps} )) && _comps[zplugin]=_zplugin
### End of Zplugin installer's chunk
# zplugin light zsh-users/zsh-autosuggestions
# zplugin light zdharma/fast-syntax-highlighting
# zplugin load zdharma/history-search-multi-word
[[ -n "${$(task ids)/[ ]*\n/}" ]] && task | tail -n+4 | head -n-2
source /home/bresilla/.config/broot/launcher/bash/br
[ -f ~/.resh/shellrc ] && source ~/.resh/shellrc