diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-24 16:13:05 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-24 16:13:05 +0100 |
| commit | 4b5ba652f773a84d34f5f65e7504ef06fde17eae (patch) | |
| tree | b4caaa73f863ae48cb65064e9ee97ceed6a35c82 /.config/shell/.zshrc | |
| parent | 204461150f735bb8234f4e86174978fb5a794de8 (diff) | |
| download | dotfiles-4b5ba652f773a84d34f5f65e7504ef06fde17eae.tar.gz dotfiles-4b5ba652f773a84d34f5f65e7504ef06fde17eae.tar.bz2 dotfiles-4b5ba652f773a84d34f5f65e7504ef06fde17eae.zip | |
rewrite zshrc
Diffstat (limited to '.config/shell/.zshrc')
| -rw-r--r-- | .config/shell/.zshrc | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/.config/shell/.zshrc b/.config/shell/.zshrc index 933df52..9f07720 100644 --- a/.config/shell/.zshrc +++ b/.config/shell/.zshrc @@ -27,6 +27,7 @@ cyan=$(tput setaf 46) lime=$(tput setaf 154) reset=$(tput sgr0) +# Precomputed colors avoid running commands in PS1 PS1="%{$blue%}%n%{$green%}@%{$cyan%}%m %{$lime%}%1~ %{$reset%}$ " # ─── 4) History ────────────────────────────────────────────────────────────── @@ -39,29 +40,15 @@ setopt hist_ignore_all_dups setopt hist_find_no_dups setopt hist_save_no_dups -# ─── 5) Completion ─────────────────────────────────────────────────────────── -autoload -U compinit -zstyle ':completion:*' menu select -zmodload zsh/complist -fpath=(/usr/share/zsh/site-functions $fpath) -[ -f "$ALIASRC" ] && source "$ALIASRC" -_comp_options+=(globdots) # hidden files -compinit - -# ─── 6) Vi mode & keybindings ──────────────────────────────────────────────── +# ─── 5) Vi mode & ZVM variables ────────────────────────────────────────────── export KEYTIMEOUT=1 -# bindkey -v # uncomment only if you don't use zsh-vi-mode plugin - -# Better backspace in vi mode -bindkey -v '^?' backward-delete-char - -# Menu navigation with vim keys -bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'j' vi-down-line-or-history -bindkey -M menuselect 'k' vi-up-line-or-history -bindkey -M menuselect 'l' vi-forward-char +ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT +ZVM_SYSTEM_CLIPBOARD_ENABLED=true +ZVM_CLIPBOARD_COPY_CMD='xclip -selection clipboard' +ZVM_CLIPBOARD_PASTE_CMD='xclip -selection clipboard -o' +ZVM_LAZY_KEYBINDINGS=false -# ─── 7) Zinit & plugins ────────────────────────────────────────────────────── +# ─── 6) Zinit & plugins ────────────────────────────────────────────────────── [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]] && { print -P "%F{33} Installing %F{220}Zinit…%f" mkdir -p "$HOME/.local/share/zinit" @@ -72,30 +59,58 @@ source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" autoload -Uz _zinit (( ${+_comps} )) && _comps[zinit]=_zinit +# Core annexes zinit light-mode for \ zdharma-continuum/zinit-annex-as-monitor \ zdharma-continuum/zinit-annex-bin-gem-node \ zdharma-continuum/zinit-annex-patch-dl \ zdharma-continuum/zinit-annex-rust +# Plugins: **vi-mode first, then autosuggestions, then others** zinit ice depth=1 zinit light-mode for \ jeffreytse/zsh-vi-mode \ zsh-users/zsh-autosuggestions \ zsh-users/zsh-completions \ zsh-users/zsh-history-substring-search \ - zsh-users/zsh-syntax-highlighting \ + zsh-users/zsh-syntax-highlighting -ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT -ZVM_SYSTEM_CLIPBOARD_ENABLED=true -ZVM_CLIPBOARD_COPY_CMD='xclip -selection clipboard' -ZVM_CLIPBOARD_PASTE_CMD='xclip -selection clipboard -o' -ZVM_LAZY_KEYBINDINGS=false +# Autosuggestions config ZSH_AUTOSUGGEST_STRATEGY=(history completion) ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#999999,bg=default,underline" ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100 -# ─── 8) Custom functions & widgets ─────────────────────────────────────────── +# ─── 7) Completion ─────────────────────────────────────────────────────────── +# Run compinit **after all plugins** to avoid wiping widgets +autoload -U compinit +compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +fpath=(/usr/share/zsh/site-functions $fpath) +_comp_options+=(globdots) # hidden files + +[ -f "$ALIASRC" ] && source "$ALIASRC" + +# ─── 8) Keybindings ────────────────────────────────────────────────────────── +# Better backspace in vi mode +bindkey -v '^?' backward-delete-char + +# Menu navigation with vim keys +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char + +# history substring search (up/down) +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down + +# accept autosuggest +bindkey '^f' autosuggest-accept + +# ─── 9) Custom functions & widgets ─────────────────────────────────────────── lfcd() { local tmp="$(mktemp -uq)" trap 'rm -f $tmp >/dev/null 2>&1' EXIT @@ -121,16 +136,7 @@ bindkey -M vicmd '^g' gitui_widget bindkey -M viins '^t' htop_widget bindkey -M vicmd '^t' htop_widget -# history substring search (up/down) -bindkey '^[[A' history-substring-search-up -bindkey '^[[B' history-substring-search-down -bindkey -M vicmd 'k' history-substring-search-up -bindkey -M vicmd 'j' history-substring-search-down - -# accept suggestion -bindkey '^f' autosuggest-accept - -# ─── 9) Tool initializations ───────────────────────────────────────────────── +# ─── 10) Tool initializations ───────────────────────────────────────────────── eval "$(zoxide init zsh)" # >>> conda initialize >>> @@ -148,5 +154,5 @@ eval "$(zoxide init zsh)" # unset __conda_setup # <<< conda initialize <<< -# ─── 10) Local overrides (create this file if needed) ───────────────────────── +# ─── 11) Local overrides (create this file if needed) ───────────────────────── [ -f ~/.zshrc.local ] && source ~/.zshrc.local |
