zsh: Update fzf-tab

Make use of colorful action groups and query input option.

By default, will group the different completion actions (if they have
been set up for the respective zsh completion) as different color sets.

When entering an input and nothing fits (or something else than
intended), it is now possible to simply hit alt+enter instead of just
enter to add whatever you typed into the zle instead of whatever fzf
provided you with (or nothing at all, if it didn't).
This commit is contained in:
Marty Oehme 2020-10-08 10:28:56 +02:00
parent 92ad105483
commit 5dde9db2e4
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -37,19 +37,23 @@ unset PLUG_FOLDER
FZF_TAB_COMMAND=( FZF_TAB_COMMAND=(
fzf fzf
--ansi # Enable ANSI color support, necessary for showing groups --ansi # Enable ANSI color support, necessary for showing groups
--expect='$continuous_trigger' # For continuous completion --expect='$continuous_trigger,$print_query' # For continuous completion and print query
'--color=hl:$(( $#headers == 0 ? 108 : 255 ))' '--color=hl:$(( $#headers == 0 ? 108 : 255 ))'
--nth=2,3 --delimiter='\x00' # Don't search prefix --nth=2,3 --delimiter='\x00' # Don't search prefix
--layout=reverse --height='${FZF_TMUX_HEIGHT:=75%}' --layout=reverse --height='${FZF_TMUX_HEIGHT:=75%}'
--tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle --tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle
'--query=$query' # $query will be expanded to query string at runtime. '--query=$query' # $query will be expanded to query string at runtime.
'--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime '--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime
--print-query
) )
zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND
# default color # format colorful groups for different completion actions
[ -e /usr/share/LS_COLORS/dircolors.sh ] && source /usr/share/LS_COLORS/dircolors.sh zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # use input as query string when completing zlua
zstyle ':fzf-tab:complete:_zlua:*' query-string input
# (experimental, may change in the future)
# some boilerplate code to define the variable `extract` which will be used later # some boilerplate code to define the variable `extract` which will be used later
# please remember to copy them
local extract=" local extract="
# trim input(what you select) # trim input(what you select)
local in=\${\${\"\$(<{f})\"%\$'\0'*}#*\$'\0'} local in=\${\${\"\$(<{f})\"%\$'\0'*}#*\$'\0'}