diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index cef3c09..36ad961 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,9 +1,30 @@ function() # Keep local variables in here. { -# Initialize completions. -autoload -Uz compinit -compinit -d "${ZSH_CACHE_DIR}/.zcompdump" +############################## Completion ###################################### + +zmodload -i zsh/complist +autoload -Uz compinit && compinit -d "${ZSH_CACHE_DIR}/zcompdump" + +setopt ALWAYS_TO_END COMPLETE_IN_WORD GLOB_COMPLETE + +# Configure completions. +zstyle ':completion:*' use-cache on +zstyle ':completion::complete:*' cache-path "${ZSH_CACHE_DIR}/zcompcache" +zstyle ':completion:*' menu select +zstyle ':completion:*' completer _complete _ignored _approximate +# Next line is hyphen- and case-insensitive, partial-word and substring +# completion, copied from oh-my-zsh. +zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' +zstyle ':completion:*' file-sort modification # access didn't work. +zstyle ':completion:complete:*' sort false # Needed for file-sort. +zstyle ':completion:complete:*:options' sort false # Don't sort command options. +zstyle ':completion:*:*:*:*:processes' \ + command "ps -u $USER -o pid,user,comm,cmd -w -w" + +compdef '_dispatch git git' config # git completions for config. + +autoload -Uz +X bashcompinit && bashcompinit # Directory options setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_MINUS @@ -31,13 +52,6 @@ add-zsh-hook zshaddhistory _my_import_history_zshaddhistory ############################## Plugins ######################################### -# Hyphen-insensitive completion. Case sensitive completion must be off. _ and - -# will be interchangeable. -HYPHEN_INSENSITIVE="true" - -# Enable command auto-correction. -ENABLE_CORRECTION="true" - # https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md export ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) @@ -77,22 +91,6 @@ zstyle ':fzf-tab:complete:man:*' fzf-preview 'whatis -l $word | cut -d- -f2,3,4, async_init -############################## Completion ###################################### - -setopt ALWAYS_TO_END COMPLETE_IN_WORD - -# Configure completions. -zstyle ':completion::complete:*' cache-path "${ZSH_CACHE_DIR}/.zcompcache" -zstyle ':completion:*' completer _complete _ignored _approximate -zstyle ':completion:*' file-sort modification # access didn't work. -# Not sure why the next line is needed. Maybe fzf-tab is setting it to true? -zstyle ':completion:complete:*' sort false # Needed for file-sort. -zstyle ':completion:complete:*:options' sort false # Don't sort command options. -zstyle ':completion:*:*:*:*:processes' \ - command "ps -u $USER -o pid,user,comm,cmd -w -w" - -compdef '_dispatch git git' config # git completions for config. - ################################################################################ function generate_terminfo_24bit()