feat: cleanup and fix zsh completion

This commit is contained in:
Patrick 2024-06-25 22:48:19 +02:00
parent 62a6893709
commit 67d737041a
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
2 changed files with 9 additions and 32 deletions

View file

@ -35,4 +35,8 @@
# This overrides compdump each time, in turn making startup very slow # This overrides compdump each time, in turn making startup very slow
enableCompletion = false; enableCompletion = false;
}; };
# But still link all completions from all packages so they
# can be found by zsh
environment.pathsToLink = ["/share/zsh"];
} }

View file

@ -1,51 +1,24 @@
# Don't insert tabs when there is no completion (e.g. beginning of line) # Don't insert tabs when there is no completion (e.g. beginning of line)
zstyle ':completion:*' insert-tab false zstyle ':completion:*' insert-tab false
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# separate matches into groups
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:options' auto-description '%d'
# describe options in full
zstyle ':completion:*:options' description 'yes'
# on processes completion complete all user processes
zstyle ':completion:*:processes' command 'ps -au$USER'
# provide verbose completion information # provide verbose completion information
zstyle ':completion:*' verbose true zstyle ':completion:*' verbose true
# Ignore completion functions for commands you don't have:
zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
# Provide more processes in completion of programs like killall:
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
# complete manual by their section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*:man:*' menu yes select
# provide .. as a completion
zstyle ':completion:*' special-dirs ..
# No correction
zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored
# treat multiple slash as one # treat multiple slash as one
zstyle ':completion:*' squeeze-slashes true zstyle ':completion:*' squeeze-slashes true
# start menu completion also if it could find unambiguous initial string
zstyle ':completion:*' insert-unambiguous false
# disable sort when completing `git checkout` # disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support # set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]' zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing # set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# force zsh to show completion menu, so common prefixes are not expanded first
zstyle ':completion:*' menu yes
# preview directory's content with ls when completing cd # preview directory's content with ls when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls -lhF --group-directories-first --show-control-chars --quoting-style=escape --color=auto $realpath'; zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls -lhF --group-directories-first --show-control-chars --quoting-style=escape --color=auto $realpath';
# preview windown min size # preview windown min size