-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
208 lines (197 loc) · 10.6 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
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
_ ()
{
# zsh-autocomplelte
. $HOME/zsh-autocomplete/zsh-autocomplete.plugin.zsh
bindkey $key[Up] up-line-or-history
bindkey $key[Down] down-line-or-history
bindkey $key[ControlSpace] set-mark-command
bindkey -M menuselect $key[Return] accept-line
alias 'suffix'="\n"
zstyle ':autocomplete:*' config off
zstyle ':completion:*' verbose no
#zstyle ':autocomplete:*' default-context # history-incremental-search-backward
zstyle ':autocomplete:tab:*' insert-unambiguous yes
zstyle ':autocomplete:tab:*' widget-style menu-select
zstyle ':autocomplete:tab:*' widget-style menu-complete
zstyle ':autocomplete:tab:*' fzf-completion yes
local h1=$'%{\e[01;02;39m%}' end=$'%{\e[0m%}' hint=$'%{\e[22;02;39m%}' kbd=$'%{\e[22;39m%}'
zstyle ':completion:*:descriptions' format "$h1%d$end"
zstyle ':completion:*:messages' format "$h1%d$end"
zstyle -e ':completion:*:warnings' format '
local d=${${(j:, :)_lastdescr[@]:#}/(#m)*, /$MATCH[1,-3] or }
reply=( "'$h1'No ${tail:+matching }$d completions found.'$end'" )'
zstyle ':completion:*:(alias-expansions|requoted|unambiguous)' format \
"$h1%d$hint (press ${kbd}Shift${hint}+${kbd}Tab$hint to insert)$end"
zstyle ':completion:*' auto-description '%d'
}
__ ()
{
# Section zsh-completion zsh-users
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true # automatically find new executables in path
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Speed up completions
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
}
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
. $path_colors/colors.zsh 2>/dev/null # Import das cores do tema.
. $path_scripts/icons 2>/dev/null # Para Polybar
export LANG="pt_BR.UTF-8"
export LC_ALL="pt_BR.UTF-8"
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
HISTFILE=~/.zhistory
HISTSIZE=1000
SAVEHIST=500
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
export EDITOR=nvim
export VISUAL=vim
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
## Keybindings section
bindkey -e
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[H' beginning-of-line # Home key
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
bindkey '^[[8~' end-of-line # End key
bindkey '^[[F' end-of-line # End key
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right key
bindkey '^[[D' backward-char # Left key
bindkey '^[[5~' history-beginning-search-backward # Page up key
bindkey '^[[6~' history-beginning-search-forward # Page down key
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word #
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
bindkey '^[[Z' undo # Shift+tab undo last action
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
## Alias section
alias mpt='kittysettitle mpTui ;/hdbkp/projetos/shell/tui/depur'
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias dots="$path_dots"
alias temas="$path_colors"
alias scripts="$path_scripts"
alias bar="$path_polybar"
alias pacinstall="sudo pacman -S"
alias pacinstalled="sudo pacman -Qe"
alias pacremove="sudo pacman -R"
alias pacremovefull="sudo pacman -Rsn"
alias pacorfaos="sudo pacman -Qdt |awk {'print $1'}"
alias aurinstalled='sudo pacman -Qm'
alias aursearch='yay -Ss'
alias aurinstall='yay -S'
alias aurremove='yay -R'
alias aurremovefull='yay -Rsn'
alias equalizer='pulseaudio-equalizer enable'
alias ls='ls --color=auto'
alias nn='nano'
alias n='kittysettitle "nvim"; nvim'
alias m='micro'
alias hd='/hdbkp/'
alias dots='$path_dots'
alias temas='$path_colors'
alias scripts='$path_scripts'
alias polybar='$path_polybar'
alias kittysettitle='kitty @set-window-title $@'
alias kittydetachwindow='kitty @detach-window'
alias volume='pulsemixer'
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Section zsh-completion zsh-users
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true # automatically find new executables in path
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Speed up completions
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Theming section
[[ $UID == 1000 ]] &&
{
autoload -U compinit colors zcalc
compinit -d
} ||
{
autoload -U colors zcalc
}
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# enable substitution for prompt
setopt prompt_subst
SeparatoR () <<< "%F{$@}"
Jobs_Runn="%K{black}%F{magenta} %F{white}%j "
Hist_Numb="%K{white}%F{magenta} %F{black} %!"
User_Prev="%(!|$(SeparatoR red)%F{white}%K{red} %k%f|$(SeparatoR blue)%F{black}%K{blue} %k%f)"
Return_Cm="%(?|$(SeparatoR green)%F{black}%K{green} %?|$(SeparatoR red)%F{black}%K{red} %?)"
Dir_Curre="%K{white}%F{black} %1~ %F{white}%K{black}"
Icon_Pont="%(!|%K{black}%F{red} %k%F{black}%f%k |%K{black}%F{blue} %k%F{black}%f%k )"
# RRPROMPT="$(SeparatoR black)$Jobs_Runn$(SeparatoR white)$Hist_Numb$Return_Cm$User_Prev"
RRPROMPT="$(SeparatoR white)$Hist_Numb$Return_Cm"
# job_status ()
# {
# [[ %j -gt 0 ]] && RPROMPT="$(SeparatoR black)%K{black}%F{magenta} %F{white}%j $RRPROMPT" || RPROMPT="$RRPROMPT"
# }
git_status ()
{
git rev-parse --is-inside-work-tree &>/dev/null &&
RPROMPT="$(SeparatoR cyan)%K{cyan}%F{black} $(git name-rev --name-only --no-undefined --always HEAD) $RRPROMPT" ||
RPROMPT="$RRPROMPT"
}
precmd_functions+=(git_status)
PROMPT="$Dir_Curre$Icon_Pont"
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Color man pages
export LESS_TERMCAP_mb=$'\E[01;32m'
export LESS_TERMCAP_md=$'\E[01;32m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;36m'
export LESS=-r
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Use syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# Use history substring search
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=fg=black,bg=white,bold,underline
# bind UP and DOWN arrow keys to history substring search
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
# autosuggestion
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=black,bg=white,bold,underline"
#|/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|#
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh