# ============================================================================= # Filip's config for the Zoomer Shell # ============================================================================= # ─── 1) Fundamental environment ────────────────────────────────────────────── [ -f "$ALIASRC" ] && source "$ALIASRC" fpath=(/usr/share/zsh/site-functions $fpath) # ─── 2) Shell behaviour ────────────────────────────────────────────────────── autoload -Uz colors && colors setopt auto_pushd setopt auto_param_slash setopt no_check_jobs setopt pushd_ignore_dups setopt pushd_silent setopt autocd setopt auto_menu setopt menu_complete setopt interactive_comments setopt no_case_glob setopt no_case_match unsetopt beep [[ -t 0 ]] && { stty stop undef stty -ixon } 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 zstyle ':completion:*' special-dirs zstyle ':completion:*' squeeze-slashes # ─── 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=100000 SAVEHIST=100000 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 append_history setopt inc_append_history setopt share_history setopt hist_ignore_all_dups setopt hist_find_no_dups setopt hist_save_no_dups setopt hist_reduce_blanks setopt hist_ignore_space # ─── 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) Antidote & plugins ─────────────────────────────────────────────────── ANTIDOTE_DIR="$HOME/.local/share/antidote" PLUGIN_FILE="${ZDOTDIR:-$HOME}/.zsh_plugins" STATIC_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/plugins.zsh" # Clone Antidote if not present [[ -d "$ANTIDOTE_DIR" ]] || git clone --depth=1 https://github.com/mattmc3/antidote.git "$ANTIDOTE_DIR" # Source Antidote source "$ANTIDOTE_DIR/antidote.zsh" # Initialize/Update the static load file if the plugin list changed if [[ ! "$STATIC_FILE" -nt "$PLUGIN_FILE" ]]; then mkdir -p "$(dirname "$STATIC_FILE")" antidote bundle < "$PLUGIN_FILE" > "$STATIC_FILE" fi # Load the plugins source "$STATIC_FILE" # 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 if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.m1) ]]; then compinit -C else compinit fi zstyle ':completion:*' menu select zmodload zsh/complist _comp_options+=(globdots extended_glob) # ─── 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