dots/.zstyle.zsh

68 lines
2.4 KiB
Bash

###################
### COMPLETIONS ###
###################
# man zshcompsys
# Specify the order of completers to use:
# - `_expand`: Expand variables and globs.
# - `_complete`: Standard completion.
# - `_ignored`: Ignore certain completions.
# - `_approximate`: Approximate matching for fuzzy completions.
zstyle ":completion:*" completer _expand _complete _ignored _approximate
# Enable case-insensitive matching
zstyle ":completion:*" matcher-list "m:{a-z}={A-Z}"
# Wrap descriptions in square brackets.
zstyle ":completion:*:descriptions" format "[%d]"
# List processes for the current user when completing process names.
zstyle ":completion:*:processes" command "ps -au$USER"
# List processes with detailed information when completing processes with fzf-tab.
zstyle ":completion:*:*:*:*:processes" command "ps -u $USER -o pid,user,comm,cmd -w -w"
# Apply LS_COLORS to completion lists for colored output
zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}
zstyle ":completion:*:matches" group "yes"
zstyle ":completion:*:corrections" format "%U%F{red}-- %d (errors: %e) --%f%u"
zstyle ":completion:*:descriptions" format "%U%F{yellow}-- %d --%f%u"
zstyle ":completion:*:messages" format "%F{purple} -- %d --%f"
zstyle ":completion:*:warnings" format "%F{red} -- no matches found --%f"
# Disable sorting of completion options
zstyle ":completion:complete:*:options" sort false
zstyle ":completion:*:options" description "yes"
zstyle ":completion:*:options" auto-description "%d"
#########################
### FZF TAB BEHAVIOUR ###
#########################
# Use default fzf options for fzf-tab
zstyle ":fzf-tab:*" use-fzf-default-opts yes
# Use the input string as the query string for _zlua completions
zstyle ":fzf-tab:complete:_zlua:*" query-string input
# Customize the kill command completion with fzf-tab
# - `extra-opts`: Additional options for fzf, including a preview window showing the command of the selected process.
zstyle ":fzf-tab:complete:kill:argument-rest" extra-opts --preview=$extract"ps --pid=$in[(w)1] -o cmd --no-headers -w -w" --preview-window=down:3:wrap
# Customize the cd command completion with fzf-tab
zstyle ":fzf-tab:complete:cd:*" fzf-preview "eza -1 --color $realpath"
# Customize the z command completion with fzf-tab
zstyle ":fzf-tab:complete:z:*" fzf-preview "eza -1 --color $realpath"
##########################
### CUSTOM COMPLETIONS ###
##########################
# man zshcompctl
compctl -g "~/.teamocil/*(:t:r)" teamocil