-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
233 lines (204 loc) · 6.27 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# --------------------------------- ALIASES -----------------------------------
# color
alias ls='lsd --color=auto'
alias lsd='lsd -al'
alias todo='todo.sh'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias pacman='pacman --color=auto'
# other
#alias ..='cd ..'
alias glog='setterm -linewrap off && git glog && setterm -linewrap on'
alias scss='scss --no-cache --quiet --sourcemap=none'
alias xclip='xclip -selection c'
# replace commands
command -v vim &> /dev/null && alias vi='vim'
command -v lsd &> /dev/null && alias ls='lsd --group-dirs first'
command -v colorls &> /dev/null && alias ls='colorls --sd --gs'
command -v htop &> /dev/null && alias top='htop'
command -v gotop &> /dev/null && alias top='gotop -p'
command -v ytop &> /dev/null && alias top='ytop -p'
# ----------------------------------- MISC -----------------------------------
export VISUAL=vim
export EDITOR=$VISUAL
# enable terminal linewrap
setterm -linewrap on
# colorize man pages
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export LESSHISTFILE=-
# ------------------------------- ZSH SETTINGS --------------------------------
# ----- options -----
unsetopt NO_BEEP
unsetopt NO_MATCH
setopt AUTO_CD
setopt BEEP
setopt NOMATCH
setopt NOTIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt HIST_BEEP
setopt INTERACTIVE_COMMENTS
setopt MAGIC_EQUAL_SUBST
setopt NULL_GLOB
HISTFILE="$HOME/.cache/zsh_history"
HIST_STAMPS=mm/dd/yyyy
DISABLE_UPDATE_PROMPT=true
HISTSIZE=5000
SAVEHIST=5000
ZLE_RPROMPT_INDENT=0
# ----- keys -----
bindkey '^[[2~' overwrite-mode
bindkey '^[[3~' delete-char
bindkey '^[[H' beginning-of-line
bindkey '^[[1~' beginning-of-line
bindkey '^[[F' end-of-line
bindkey '^[[4~' end-of-line
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^[[3;5~' kill-word
bindkey '^[[5~' beginning-of-buffer-or-history
bindkey '^[[6~' end-of-buffer-or-history
# ----- promt -----
PS1="%F{cyan} %~ >%F{blue}> %F{reset}"
# ZSH Autosuggestions
#_source_plugin zsh-autosuggestions
# ZSH Syntax Highlighting
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#ccc'
#_source_plugin zsh-syntax-highlighting
# ZSH completion system
autoload compinit && compinit -d "$HOME/.cache/zcompdump"
# -------------------------------- POWERLEVEL ---------------------------------
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K=truncate_beginning
POWERLEVEL9K_TIME_BACKGROUND=black
POWERLEVEL9K_TIME_FOREGROUND=white
POWERLEVEL9K_TIME_FORMAT=%D{%I:%M}
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_VCS_CLEAN_FOREGROUND=black
POWERLEVEL9K_VCS_CLEAN_BACKGROUND=green
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=black
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=yellow
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=white
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=black
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=black
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=blue
POWERLEVEL9K_FOLDER_ICON=
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
POWERLEVEL9K_VCS_UNTRACKED_ICON=●
POWERLEVEL9K_VCS_UNSTAGED_ICON=±
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=↓
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=↑
POWERLEVEL9K_VCS_COMMIT_ICON=' '
POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=
#POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%F{blue}╭─'
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%F{blue}%f '
POWERLEVEL9K_CUSTOM_OS_ICON='echo $(whoami) '
#POWERLEVEL9K_CUSTOM_OS_ICON_BACKGROUND=red
#POWERLEVEL9K_CUSTOM_OS_ICON_FOREGROUND=white
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_os_icon root_indicator ssh dir dir_writable vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time status background_jobs time ram vpn_ip battery)
switch_powerlevel_multiline_prompt(){
[ $POWERLEVEL9K_PROMPT_ON_NEWLINE = true ] \
&& POWERLEVEL9K_PROMPT_ON_NEWLINE=false \
|| POWERLEVEL9K_PROMPT_ON_NEWLINE=true
zle && zle accept-line
}
zle -N switch_powerlevel_multiline_prompt
bindkey ^P switch_powerlevel_multiline_prompt
# -------------------------------- FUNCTIONS ---------------------------------
lazygit() {
USAGE="
lazygit [OPTION]... <msg>
GIT but lazy
Options:
--fixup <commit> runs 'git commit --fixup <commit> [...]'
--amend runs 'git commit --amend --no-edit [...]'
-f, --force runs 'git push --force-with-lease [...]'
-h, --help show this help text
"
COMMIT=''
MESSAGE=''
AMEND=0
FORCE=0
while [ $# -gt 0 ]
do
key="$1"
case $key in
--fixup)
COMMIT="$2"
shift # past argument
shift # past value
;;
--amend)
AMEND=1
shift # past argument
;;
-f|--force)
FORCE=1
shift # past argument
;;
-h|--help)
echo "$USAGE"
return 0
;;
*)
MESSAGE="$1"
shift # past argument
;;
esac
done
git status .
git add .
if [ $AMEND -eq 1 ]
then
git commit --amend --no-edit
elif [ "$COMMIT" != '' ]
then
git commit --fixup "$COMMIT"
GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash "$COMMIT^"
else
git commit -m "$MESSAGE"
fi
git push origin HEAD $([ "$FORCE" -eq 1 ] && echo '--force-with-lease')
}
find() {
if [ $# = 1 ];
then
command find . -iname "*$@*"
else
command find "$@"
fi
}
echo ""
neofetch --color_blocks on/off | lolcat --seed=5
source ~/powerlevel10k/powerlevel10k.zsh-theme
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#ccc'
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /home/mr-robot/.oh-my-zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export PATH=$PATH:/snap/bin
source ~/vpn_env_set