# ============================================================================= # Filip's config for the zoomer shell # ============================================================================= # ─── 1) Fundamental environment ────────────────────────────────────────────── [ -f "$ALIASRC" ] && source "$ALIASRC" # ─── 2) Shell behaviour ────────────────────────────────────────────────────── autoload -U colors && colors setopt auto_pushd setopt no_check_jobs setopt pushd_ignore_dups setopt pushd_silent setopt autocd setopt interactive_comments stty stop undef stty -ixon unsetopt beep zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache" zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' zstyle ':completion:*' use-cache on # ─── 3) Prompt ─────────────────────────────────────────────────────────────── local blue=$(tput setaf 34) local green=$(tput setaf 40) local cyan=$(tput setaf 46) local lime=$(tput setaf 154) local reset=$(tput sgr0) # Precomputed colors avoid running commands in PS1 PS1="%{$blue%}%n%{$green%}@%{$cyan%}%m %{$lime%}%1~ %{$reset%}$ " # ─── 4) History ────────────────────────────────────────────────────────────── HISTSIZE=10000000 SAVEHIST=10000000 if [[ ! -d "${XDG_CACHE_HOME:-$HOME/.cache}/shell" ]]; then mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/shell" fi HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history" setopt inc_append_history setopt hist_ignore_all_dups setopt hist_find_no_dups setopt hist_save_no_dups # ─── 5) Vi mode & ZVM variables ────────────────────────────────────────────── export KEYTIMEOUT=1 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" # ─── 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" git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" } 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 # Autosuggestions config ZSH_AUTOSUGGEST_STRATEGY=(history completion) ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#999999,bg=default,underline" ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100 # ─── 7) Completion ─────────────────────────────────────────────────────────── # Run compinit **after all plugins** to avoid wiping widgets autoload -Uz compinit for dump in "${ZDOTDIR:-$HOME}/.zcompdump"(N.m1); do compinit break done compinit -C zstyle ':completion:*' menu select zmodload zsh/complist fpath=(/usr/share/zsh/site-functions $fpath) _comp_options+=(globdots) # hidden files # ─── 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 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT lf -last-dir-path="$tmp" "$@" [ -f "$tmp" ] && { local dir="$(cat "$tmp")" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" } } lfcd_widget() { zle -I; BUFFER="lfcd" ; zle accept-line; } fzo_widget() { zle -I; BUFFER="fzo" ; zle accept-line; } gitui_widget() { zle -I; BUFFER="gitui"; zle accept-line; } htop_widget() { zle -I; BUFFER="htop" ; zle accept-line; } zle -N lfcd_widget zle -N fzo_widget zle -N gitui_widget zle -N htop_widget bindkey -M viins '^o' lfcd_widget bindkey -M vicmd '^o' lfcd_widget bindkey -M viins '^z' fzo_widget bindkey -M vicmd '^z' fzo_widget bindkey -M viins '^g' gitui_widget bindkey -M vicmd '^g' gitui_widget bindkey -M viins '^t' htop_widget bindkey -M vicmd '^t' htop_widget # ─── 10) Tool initializations ───────────────────────────────────────────────── eval "$(zoxide init zsh)" eval "$(thefuck --alias)" # ─── 11) Local overrides (create this file if needed) ───────────────────────── [ -f ~/.zshrc.local ] && source ~/.zshrc.local