zsh/completion.zsh

68 lines
2.4 KiB
Bash
Raw Permalink Normal View History

2018-01-22 12:09:53 +00:00
# autoload completions
2023-08-21 09:53:57 +00:00
fpath=( "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions" "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath )
2023-03-02 15:07:52 +00:00
fpath=("$XDG_DATA_HOME/scalacli/completions/zsh" $fpath)
2018-01-22 12:09:53 +00:00
[[ -n $(echo /etc/zsh/compdef/*(N:t)) ]] && autoload -U /etc/zsh/compdef/*(N:t)
[[ -n $(echo $ZDOTDIR/compdef/*(N:t)) ]] && autoload -U $ZDOTDIR/compdef/*(N:t)
2018-01-22 12:09:53 +00:00
2021-02-26 09:28:08 +00:00
ZSH_COMPDUMP_LOCATION=${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION
2020-09-16 10:01:40 +00:00
mkdir -p ${ZSH_COMPDUMP_LOCATION:h}
2020-05-15 14:33:20 +00:00
autoload -Uz compinit
if [[ ${UID} -eq 0 ]] && [[ -n ${SUDO_USER} ]]; then
2020-09-16 10:01:40 +00:00
compinit -u -d $ZSH_COMPDUMP_LOCATION
2020-05-15 14:33:20 +00:00
else
2020-09-16 10:01:40 +00:00
compinit -d $ZSH_COMPDUMP_LOCATION
2020-05-15 14:33:20 +00:00
fi
2020-09-16 10:01:40 +00:00
unset ZSH_COMPDUMP_LOCATION
2020-02-13 13:21:42 +00:00
autoload -U +X bashcompinit && bashcompinit
2018-01-22 12:09:53 +00:00
zstyle ':completion:*:descriptions' format %B%d%b
zstyle ':completion:*:messages' format %d
zstyle ':completion:*:warnings' format No matches for: %d
2023-08-21 09:53:57 +00:00
zstyle ':completion:*' use-cache on
2020-03-05 18:26:17 +00:00
zstyle ':completion:*' cache-path ~/.cache/zsh
2023-08-21 09:53:57 +00:00
zstyle ':completion:*' completer _complete _ignored _match _approximate _correct
2019-02-11 14:36:37 +00:00
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
zstyle ':completion:*:functions' ignored-patterns '_*'
2023-08-21 09:53:57 +00:00
zstyle ':completion:*' squeeze-slashes true
2019-02-11 14:36:37 +00:00
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/etc/zsh/completion'
2018-01-22 12:09:53 +00:00
# completion for programs with standard gnu --help
2020-02-13 13:21:42 +00:00
for prog in amm tapestry virtualenv dragon; do
2018-01-22 12:09:53 +00:00
compdef _gnu_generic $prog
done
# custom compdefs
compdef _xbps xi=xbps-install
2019-02-11 14:36:37 +00:00
{
local _myhosts
_myhosts=( $(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' ~/.ssh/config) )
zstyle ':completion:*' hosts $_myhosts
}&>/dev/null
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
compdef _command fork
compdef _command detach
compdef _command ontv
compdef _notmuch nmfind=notmuch-search
2021-06-18 10:09:38 +00:00
if exists kitty; then
kitty + complete setup zsh | source /dev/stdin
fi