chore(zsh): update .zshrc aliases and env
This commit is contained in:
1 parent
e611a1852b
commit
404e88878a
1 file changed
+73
-68
@@ -1,78 +1,98 @@
|
||||
HISTFILE="$HOME/.zsh_history"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
bindkey -v
|
||||
bindkey -v
|
||||
bindkey -M viins "^[[3~" delete-char
|
||||
bindkey -M vicmd "^[[3~" delete-char
|
||||
bindkey -M viins "^[[2~" overwrite-mode
|
||||
bindkey -M vicmd "^[[2~" overwrite-mode
|
||||
bindkey -M viins "^[[H" beginning-of-line
|
||||
bindkey -M vicmd "^[[H" beginning-of-line
|
||||
bindkey -M viins "^[[F" end-of-line
|
||||
bindkey -M vicmd "^[[F" end-of-line
|
||||
bindkey -M viins "^[[5~" history-search-backward
|
||||
bindkey -M vicmd "^[[5~" history-search-backward
|
||||
bindkey -M viins "^[[6~" history-search-forward
|
||||
bindkey -M vicmd "^[[6~" history-search-forward
|
||||
KEYTIMEOUT=1
|
||||
|
||||
setopt APPEND_HISTORY
|
||||
setopt SHARE_HISTORY
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
autoload -U compinit
|
||||
compinit
|
||||
source <(fzf --zsh)
|
||||
|
||||
if [[ -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
|
||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
fi
|
||||
|
||||
if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
fi
|
||||
|
||||
if [[ -f ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zsh ]]; then
|
||||
source ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zsh
|
||||
fi
|
||||
|
||||
if [[ -f ~/.zsh/plugins/fzf-tab-completion/zsh/fzf-tab-completion.plugin.zsh ]]; then
|
||||
source ~/.zsh/plugins/fzf-tab-completion/zsh/fzf-tab-completion.plugin.zsh
|
||||
fi
|
||||
|
||||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||||
ZSH_HIGHLIGHT_STYLES[default]='fg=#eceff4'
|
||||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#bf616a'
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=#88c0d0'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#88c0d0'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=#8fbcbb'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=#88c0d0'
|
||||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=#81a1c1,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#81a1c1'
|
||||
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#d08770'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=#eceff4,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#eceff4,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[optstring]='fg=#ebcb8b'
|
||||
ZSH_HIGHLIGHT_STYLES[argument-base]='fg=#eceff4'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-parameter]='fg=#b48ead'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-parameter_extension]='fg=#b48ead'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#a3be8c'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#a3be8c'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#a3be8c'
|
||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=#4c566a,italic'
|
||||
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#ebcb8b'
|
||||
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#d08770'
|
||||
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main cursor)
|
||||
typeset -gA ZSH_HIGHLIGHT_STYLES
|
||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=#585b70'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[global-alias]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=#a6e3a1,italic'
|
||||
ZSH_HIGHLIGHT_STYLES[autodirectory]='fg=#fab387,italic'
|
||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=#fab387'
|
||||
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=#fab387'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=#cba6f7'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=#a6e3a1'
|
||||
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#f38ba8'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-unquoted]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]='fg=#f38ba8'
|
||||
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=#f38ba8'
|
||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=#f38ba8'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-quoted]='fg=#f9e2af'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-quoted]='fg=#f9e2af'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#f9e2af'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=#eba0ac'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#f9e2af'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=#eba0ac'
|
||||
ZSH_HIGHLIGHT_STYLES[rc-quote]='fg=#f9e2af'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]='fg=#eba0ac'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[assign]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[named-fd]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[numeric-fd]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#eba0ac'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=#cdd6f4,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#cdd6f4,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='fg=#f38ba8,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#cba6f7'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-unclosed]='fg=#eba0ac'
|
||||
ZSH_HIGHLIGHT_STYLES[redirection]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[default]='fg=#cdd6f4'
|
||||
ZSH_HIGHLIGHT_STYLES[cursor]='fg=#cdd6f4'
|
||||
zstyle ':fzf-tab:*' fzf-flags \
|
||||
--color=fg:#eceff4,bg:#2e3440,fg+:#eceff4,bg+:#3b4252 \
|
||||
--color=hl:#88c0d0,hl+:#88c0d0,info:#b48ead,prompt:#81a1c1 \
|
||||
--color=pointer:#88c0d0,marker:#a3be8c,spinner:#88c0d0,header:#5e81ac \
|
||||
--color=border:#4c566a,label:#8fbcbb,query:#eceff4 \
|
||||
--color=preview-fg:#eceff4,preview-bg:#2e3440,preview-border:#4c566a,preview-label:#8fbcbb \
|
||||
--color=gutter:#3b4252,separator:#434c5e,scrollbar:#5e81ac,preview-scrollbar:#5e81ac \
|
||||
--color=disabled:#4c566a \
|
||||
--prompt='❯ '
|
||||
|
||||
export FZF_DEFAULT_OPTS="
|
||||
--color=fg:#eceff4,bg:#2e3440,fg+:#eceff4,bg+:#3b4252
|
||||
--color=hl:#88c0d0,hl+:#88c0d0,info:#b48ead,prompt:#81a1c1
|
||||
--color=pointer:#88c0d0,marker:#a3be8c,spinner:#88c0d0,header:#5e81ac
|
||||
--color=border:#4c566a,label:#8fbcbb,query:#eceff4
|
||||
--color=preview-fg:#eceff4,preview-bg:#2e3440,preview-border:#4c566a,preview-label:#8fbcbb
|
||||
--color=gutter:#3b4252,separator:#434c5e,scrollbar:#5e81ac,preview-scrollbar:#5e81ac
|
||||
--color=disabled:#4c566a
|
||||
--prompt='❯ '
|
||||
"
|
||||
|
||||
--color=bg+:#313244,bg:#1E1E2E,spinner:#F5E0DC,hl:#F38BA8 \
|
||||
--color=fg:#CDD6F4,header:#F38BA8,info:#CBA6F7,pointer:#F5E0DC \
|
||||
--color=marker:#B4BEFE,fg+:#CDD6F4,prompt:#CBA6F7,hl+:#F38BA8 \
|
||||
--color=selected-bg:#45475A \
|
||||
--color=border:#6C7086,label:#CDD6F4
|
||||
export FZF_DEFAULT_OPTS=" \
|
||||
--color=bg+:#313244,bg:#1E1E2E,spinner:#F5E0DC,hl:#F38BA8 \
|
||||
--color=fg:#CDD6F4,header:#F38BA8,info:#CBA6F7,pointer:#F5E0DC \
|
||||
--color=marker:#B4BEFE,fg+:#CDD6F4,prompt:#CBA6F7,hl+:#F38BA8 \
|
||||
--color=selected-bg:#45475A \
|
||||
--color=border:#6C7086,label:#CDD6F4"
|
||||
prompt_symbol() {
|
||||
if [[ "$KEYMAP" == "vicmd" ]]; then
|
||||
print -r -- "%F{#ebcb8b}❮%f"
|
||||
@@ -80,20 +100,16 @@ prompt_symbol() {
|
||||
print -r -- "%F{#88c0d0}❯%f"
|
||||
fi
|
||||
}
|
||||
|
||||
update_vim_prompt() {
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle-keymap-select() {
|
||||
update_vim_prompt
|
||||
}
|
||||
|
||||
zle-line-init() {
|
||||
zle -K viins
|
||||
update_vim_prompt
|
||||
}
|
||||
|
||||
git_prompt_info() {
|
||||
local branch
|
||||
local staged
|
||||
@@ -102,19 +118,15 @@ git_prompt_info() {
|
||||
local deleted
|
||||
local conflicts
|
||||
local git_state=""
|
||||
|
||||
branch=$(git branch --show-current 2>/dev/null)
|
||||
|
||||
if [[ -z "$branch" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
staged=$(git diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ')
|
||||
modified=$(git diff --name-only 2>/dev/null | wc -l | tr -d ' ')
|
||||
untracked=$(git ls-files --others --exclude-standard 2>/dev/null | wc -l | tr -d ' ')
|
||||
deleted=$(git diff --name-only --diff-filter=D 2>/dev/null | wc -l | tr -d ' ')
|
||||
conflicts=$(git diff --name-only --diff-filter=U 2>/dev/null | wc -l | tr -d ' ')
|
||||
|
||||
if (( staged > 0 )); then
|
||||
git_state+=" %F{#b48ead} ${staged}%f"
|
||||
fi
|
||||
@@ -122,7 +134,7 @@ git_prompt_info() {
|
||||
git_state+=" %F{#ebcb8b} ${modified}%f"
|
||||
fi
|
||||
if (( untracked > 0 )); then
|
||||
git_state+=" %F{#a3be8c} ${untracked}%f"
|
||||
git_state+=" %F{#a3be8c} ${untracked}%f"
|
||||
fi
|
||||
if (( deleted > 0 )); then
|
||||
git_state+=" %F{#d08770} ${deleted}%f"
|
||||
@@ -133,31 +145,24 @@ git_prompt_info() {
|
||||
if [[ -n "$git_state" ]]; then
|
||||
git_state=" %F{#88c0d0}❯%f${git_state}"
|
||||
fi
|
||||
|
||||
print -r -- " %F{#88c0d0}❯%f %F{#8fbcbb} ${branch}%f${git_state}"
|
||||
}
|
||||
|
||||
precmd() {
|
||||
local exit_code=$?
|
||||
|
||||
if (( exit_code != 0 )); then
|
||||
PROMPT_EXIT="%F{#941703}✗${exit_code}%f "
|
||||
else
|
||||
PROMPT_EXIT=""
|
||||
fi
|
||||
}
|
||||
|
||||
nvim() {
|
||||
printf '\033]0;nvim\007'
|
||||
command nvim "$@"
|
||||
printf '\033]0;foot\007'
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
zle -N zle-line-init
|
||||
|
||||
PROMPT='%F{#eceff4}%~%f$(git_prompt_info) $(prompt_symbol) '
|
||||
|
||||
vi() { nvim "$@"; }
|
||||
vim() { nvim "$@"; }
|
||||
PROMPT='%F{#eceff4}%~%f$(git_prompt_info) $(prompt_symbol) '
|
||||
alias rmpc='printf "\033]0;rmpc\007"; command rmpc; printf "\033]0;foot\007"'
|
||||
Reference in new issue
Block a user