44 lines
1.8 KiB
Bash
44 lines
1.8 KiB
Bash
zmodload zsh/complist
|
||
autoload -Uz compinit && compinit
|
||
|
||
# Completion context pattern:
|
||
# :completion:<function>:<completer>:<command>:<argument>:<tag>
|
||
|
||
zstyle ':completion:*' completer _extensions _complete _approximate
|
||
|
||
# Match case-insensitively and on partial words.
|
||
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||
|
||
# Activate caching for completions that may use it.
|
||
zstyle ':completion:*' use-cache true
|
||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
||
|
||
# List files in a format similar to `ls -l`.
|
||
zmodload zsh/stat # required for `file-list all`
|
||
disable stat # don't shadow external `stat` executable
|
||
zstyle ':completion:*' file-list all
|
||
|
||
# Don't complete on all path components, which would complete /u/b/z to /usr/bin/zsh.
|
||
zstyle ':completion:*' path-completion false
|
||
|
||
# Use tags as the group names.
|
||
zstyle ':completion:*' group-name ''
|
||
|
||
# Custom order for words in the command position.
|
||
zstyle ':completion:*:*:-command-:*:*' group-order builtins aliases functions commands
|
||
|
||
# Colors!
|
||
zstyle ':completion:*:*:*:*:descriptions' format '%F{green} ❯❯ %d ❮❮%f'
|
||
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow} ❯❯ %d ❮❮%f'
|
||
zstyle ':completion:*:*:*:*:original' format '%F{yellow} ❯❯ %d ❮❮%f'
|
||
zstyle ':completion:*:*:*:*:messages' format '%F{cyan} ❯❯ %d ❮❮%f'
|
||
zstyle ':completion:*:*:*:*:warnings' format '%F{red} ❯❯ no matches ❮❮%f'
|
||
zstyle ':completion:*:*:*:*:default' list-colors true
|
||
|
||
# Menu completion.
|
||
zstyle ':completion:*' menu select
|
||
bindkey -M menuselect 'h' vi-backward-char
|
||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||
bindkey -M menuselect 'l' vi-forward-char
|
||
|