From cf1df09a9eb4ef666c80376b9d08b120bdc8ceba Mon Sep 17 00:00:00 2001 From: gwg313 Date: Thu, 10 Apr 2025 01:38:00 -0400 Subject: [PATCH] update zsh --- home-manager/modules/zsh.nix | 62 +++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/home-manager/modules/zsh.nix b/home-manager/modules/zsh.nix index 9e6698d..e7f01f4 100644 --- a/home-manager/modules/zsh.nix +++ b/home-manager/modules/zsh.nix @@ -33,7 +33,7 @@ ps = "procs"; grep = "rg"; - cat = "bat"; + cat = "bat --theme=base16 --color=always --paging=never --tabs=2 --wrap=never --plain"; vim = "nvim"; # Default flags @@ -69,6 +69,66 @@ }; initExtra = '' eval $(thefuck --alias) + + # search history based on what's typed in the prompt + autoload -U history-search-end + zle -N history-beginning-search-backward-end history-search-end + zle -N history-beginning-search-forward-end history-search-end + bindkey "^[OA" history-beginning-search-backward-end + bindkey "^[OB" history-beginning-search-forward-end + + + # General completion behavior + zstyle ':completion:*' completer _extensions _complete _approximate + # Use cache + zstyle ':completion:*' use-cache on + zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache" + + + # Complete the alias + zstyle ':completion:*' complete true + # Autocomplete options + zstyle ':completion:*' complete-options true + + + # Completion matching control + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zstyle ':completion:*' keep-prefix true + + + # Group matches and describe + zstyle ':completion:*' menu select + zstyle ':completion:*' list-grouped false + zstyle ':completion:*' list-separator ''' + zstyle ':completion:*' group-name ''' + zstyle ':completion:*' verbose yes + zstyle ':completion:*:matches' group 'yes' + zstyle ':completion:*:warnings' format '%F{red}%B-- No match for: %d --%b%f' + zstyle ':completion:*:messages' format '%d' + zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' + zstyle ':completion:*:descriptions' format '[%d]' + + + # Colors + zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} + + + # case insensitive tab completion + zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories + zstyle ':completion:*:*:cd:*:directory-stack' menu yes select + zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand' + zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands + zstyle ':completion:*' special-dirs true + zstyle ':completion:*' squeeze-slashes true + + + # Sort + zstyle ':completion:*' sort false + zstyle ":completion:*:git-checkout:*" sort false + zstyle ':completion:*' file-sort modification + zstyle ':completion:*:eza' sort false + zstyle ':completion:complete:*:options' sort false + zstyle ':completion:files' sort false ''; };