From 54aed5d054301f534905688be1ec3dbbd7cca906 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Tue, 21 May 2024 02:56:29 +0100 Subject: [PATCH] feat(shell/completion): add a custom override for fzf-tab-source --- zsh/fzf-tab/sources/-command-.zsh | 15 +++++++++++++++ zshrc | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 zsh/fzf-tab/sources/-command-.zsh diff --git a/zsh/fzf-tab/sources/-command-.zsh b/zsh/fzf-tab/sources/-command-.zsh new file mode 100644 index 0000000..39b6d77 --- /dev/null +++ b/zsh/fzf-tab/sources/-command-.zsh @@ -0,0 +1,15 @@ +# :fzf-tab:complete:(-command-:|command:option-(v|V)-rest) +case $group in + 'external command'|'alias') + which $word + ;; + 'executable file') + which ${realpath#--*=} + ;; + 'builtin command'|'reserved word') + run-help $word | bat -lman + ;; + parameter) + echo ${(P)word} + ;; +esac diff --git a/zshrc b/zshrc index f8cfe4f..d5f7748 100644 --- a/zshrc +++ b/zshrc @@ -82,6 +82,7 @@ if command-exists fzf; then zinit light-mode wait lucid atclone'git checkout fit-preview' \ for @jimeh/fzf-tab + zstyle ':fzf-tab:sources' config-directory "$DOTZSH/fzf-tab/sources" zinit light-mode lucid for @Freed-Wu/fzf-tab-source # Disable some overly aggressive completions from fzf-tab-source. zstyle -d ':fzf-tab:complete:*' fzf-preview @@ -96,9 +97,9 @@ zinit light-mode wait lucid atload"!_zsh_autosuggest_start" \ bindkey '^Xh' _complete_help # Group completions by type under group headings -zstyle ':completion:*' format '[%d]' +zstyle ':completion:*' format '%d' zstyle ':completion:*' group-name '' -zstyle ':completion:*:descriptions' format '[%d]' +zstyle ':completion:*:descriptions' format '%d' zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' list-grouped true zstyle ':autocomplete:*' groups 'always'