dots/.zstyle.zsh

62 lines
2.6 KiB
Bash

###################
### COMPLETIONS ###
###################
# 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}'
# Disable the menu selection feature (automatically select the first match)
zstyle ':completion:*' menu no
# Customize the prompt shown when scrolling through completions
# - `%SScrolling active: current selection at %p%s`: Shows a message indicating that scrolling is active and the current selection.
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
# Format descriptions in completion lists
# - `[%d]`: Wrap descriptions in square brackets.
zstyle ':completion:*:descriptions' format '[%d]'
# Specify the command to use for completing process names
# - `ps -au$USER`: List processes for the current user.
zstyle ':completion:*:processes' command 'ps -au$USER'
# Specify the command to use for completing process names with fzf-tab
# - `ps -u $USER -o pid,user,comm,cmd -w -w`: List processes with detailed information.
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
# Disable sorting of completion options
zstyle ':completion:complete:*:options' sort false
# Disable sorting of git checkout completions
zstyle ":completion:*:git-checkout:*" sort false
# Apply LS_COLORS to completion lists for colored output
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# Configure fzf-tab behavior
# 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
# - `fzf-preview`: Show a preview of directories using `eza` (a modern replacement for `ls`).
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# Customize the z command completion with fzf-tab
# - `fzf-preview`: Show a preview of directories using `eza`.
zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath'
# Use default fzf options for fzf-tab
zstyle ':fzf-tab:*' use-fzf-default-opts yes