1
0
Fork 0

Zsh: Improve completions a bit

<https://thevaluable.dev/zsh-completion-guide-examples/>
This commit is contained in:
tastytea 2022-04-09 06:41:09 +02:00
parent 762ad2cd4a
commit 00fb63e60a
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 6 additions and 8 deletions

View File

@ -6,23 +6,22 @@ function() # Keep local variables in here.
zmodload zsh/complist
autoload -Uz compinit && compinit -d "${ZSH_CACHE_DIR}/zcompdump"
setopt ALWAYS_TO_END COMPLETE_IN_WORD GLOB_COMPLETE
setopt ALWAYS_TO_END COMPLETE_IN_WORD GLOB_COMPLETE LIST_PACKED
zmodload zsh/zutil
zmodload zsh/complist
# Configure completions.
zstyle ':completion:*' use-cache on
zstyle ':completion::complete:*' cache-path "${ZSH_CACHE_DIR}/zcompcache"
zstyle ':completion:*' cache-path "${ZSH_CACHE_DIR}/zcompcache"
zstyle ':completion:*' menu select
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' completer _extensions _complete _approximate _ignored
# 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"
zstyle ':completion:*' sort false # Needed for file-sort.
zstyle ':completion:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
compdef '_dispatch git git' config # git completions for config.
@ -33,7 +32,6 @@ export HISTSIZE=50000 # In memory.
export SAVEHIST=10000 # On disk.
# Write command to history file after it is finished, with time and duration.
setopt NO_SHARE_HISTORY EXTENDED_HISTORY INC_APPEND_HISTORY_TIME
# setopt NO_INC_APPEND_HISTORY_TIME EXTENDED_HISTORY SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE HIST_REDUCE_BLANKS HIST_VERIFY HIST_FCNTL_LOCK