Closed roachsinai closed 4 years ago
I'm not sure it't a bug or shoulb be a feature. As fzf-tab
and tab
(zsh default) have a same behaviro when use command cd
.
First I talk above tab default
:
I have a directory named test
, it has 5 subdirectories:
hmank ~/t/test » tree
.
├── 11tt
├── 1tt
├── tt
├── ttt
└── tttt
Below gif shows I do cd
command 3 time, first one I want zsh complete cd tt
, second on is cd 1
and last one is cd 1t
, they get three different completions.
And the next gif show fzf-tab
return same results.
But I think it's better if fzf-tab
have different behavir: 11tt
shows in all three situations, it's fuzzy, right?
So, there is two expected for fzf-tab
:
vim.coc
for ce coc
TAB
.11tt
shows for cd tt
TAB
, cd 1
TAB
, cd 1t
TAB
.This seems to be a bug but I can't reproduce it. Can you provide a minimal zshrc that can reproduce this bug?
fzf-tab is not a completion engine. It's a "front end" of compsys ( zsh's builtin completion system) and aims to give the same result as compsys.
As for the feature you want, you can use matcher-list
tag to control the behavior of compsys:
zstyle ':completion:*' matcher-list 'b:=*'
Here the b:=*
means the beginning of the string can match any characters. So 1t
will match *1t*
( the final *
is compsys's default suffix completion ).
I update all my comments in this issue, as I found <TAB>
will not show, so I change it to make my comments more clear. Will try to find a minimal zshrc.
export PATH="/usr/lib/smlnj/bin:$PATH"
export EDITOR='vim'
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
# colored prompt
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
# Load and initialize the completion system ignoring insecure directories with a
# cache time of 20 hours, so it should almost always regenerate the first time a
# shell is opened each day.
#
# https://github.com/sorin-ionescu/prezto/blob/e94b6b2078ccd0b289293dc4b996983a96a34681/modules/completion/init.zsh#L34
autoload -Uz compinit
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
if (( $#_comp_files )); then
compinit -i -C
else
compinit -i
fi
unset _comp_files
# folder of all of your autocomplete functions
# fpath=($HOME/.zsh-completions $fpath)
# https://github.com/lilydjwg/dotzsh/blob/c4729061a9c6ae3cc371cb236a547febc770eaa8/zshrc#L165
autoload -Uz bracketed-paste-url-magic
zle -N bracketed-paste bracketed-paste-url-magic
# zsh 5.1+ uses bracketed-paste-url-magic
if [[ $ZSH_VERSION =~ '^[0-4]\.' || $ZSH_VERSION =~ '^5\.0\.[0-9]' ]]; then
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
toggle-uqm () {
if zle -l self-insert; then
zle -A .self-insert self-insert && zle -M "switched to self-insert"
else
zle -N self-insert url-quote-magic && zle -M "switched to url-quote-magic"
fi
}
zle -N toggle-uqm
bindkey '^X$' toggle-uqm
fi
# miniconda ycm uncompatible.
# alias vim="PATH=/usr/bin vim"
# Updates editor information when the keymap changes.
function zle-keymap-select() {
zle reset-prompt
zle -R
}
# Ensure that the prompt is redrawn when the terminal size changes.
TRAPWINCH() {
zle && { zle -R; zle reset-prompt }
}
zle -N zle-keymap-select
zle -N edit-command-line
setopt auto_cd
# cheat
alias ct="cheat"
alias ce="cheat -e"
export CHEAT_USE_FZF=true
# vi-mode, fzf and fzf-tab must in order:
# fzf remap ^T, ^I of vi-mode
# fzf-tab remap fzf ^T
# https://github.com/junegunn/fzf/wiki/Configuring-fuzzy-completion#caveats
source /usr/share/fzf/completion.zsh
source /usr/share/fzf/key-bindings.zsh
export FZF_COMPLETION_TRIGGER=''
bindkey '^T' fzf-completion
bindkey '^I' $fzf_default_completion
source $HOME/.zshrc.d/plugins/fzf-tab/fzf-tab.plugin.zsh
bindkey '^T' toggle-fzf-tab
# zsh-autosuggestions settings
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
I should not bind ^T
to fzf in my zshrc, lol.
= = This is not minimal at all.
What made me confused is why ce coc
will be completed to ce vim.coc
. This is not the default behavior of compsys.
What's the output of autoload +X _cheat; which _cheat
and zstyle
?
Oh, sorry for that.
hmank ~ » autoload +X _cheat; which _cheat
_cheat () {
local -a cheats
cheats=()
_cheat_complete_cheatsheets () {
cheats=("${(f)$(cheat -l -t personal | tail -n +2 | cut -d' ' -f1)}")
_describe -t cheats 'cheats' cheats
}
_cheat () {
local prev
_arguments -C '(--init)--init[Write a default config file to stdout]' '(-c --colorize)'{-c,--colorize}'[Colorize output]' '(-d --directories)'{-d,--directories}'[List cheatsheet directories]' '(-e --edit)'{-e,--edit}'[Edit <sheet>]: :->full' '(-l --list)'{-l,--list}'[List cheatsheets]' '(-p --path)'{-p,--path}'[Return only sheets found on path <name>]' '(-r --regex)'{-r,--regex}'[Treat search <phrase> as a regex]' '(-s --search)'{-s,--search}'[Search cheatsheets for <phrase>]' '(-t --tag)'{-t,--tag}'[Return only sheets matching <tag>]' '(-T --tags)'{-T,--tags}'[List all tags in use]' '(-v --version)'{-v,--version}'[Print the version number]' '(--rm)--rm[Remove (delete) <sheet>]'
case $state in
(full) _cheat_complete_cheatsheets ;;
esac
}
_cheat
}
hmank ~ » zstyle
actionformats
:vcs_info:* '%F{2}%b%F{3}|%F{1}%a '
cache-path
:completion::complete:*
command
:completion:*:*:*:*:processes 'ps -u roach -o pid,user,comm -w -w'
:fzf-tab:* fzf --ansi '--expect=$continuous_trigger' '--color=hl:$(( $#headers == 0 ? 108 : 255 ))' '--nth=2,3' '--delimiter=\x00' '--layout=reverse' '--height=${FZF_TMUX_HEIGHT:=75%}' '--tiebreak=begin' -m '--bind=tab:down,btab:up,change:top,ctrl-space:toggle' --cycle '--query=$query' '--header-lines=$#headers'
continuous-trigger
:fzf-tab:* /
enable
:vcs_info:* git
extra-opts
:fzf-tab:*
fake-compadd
:fzf-tab:* default
formats
:vcs_info:* '%b '
group-colors
:fzf-tab:* $'\C-[[94m' $'\C-[[32m' $'\C-[[33m' $'\C-[[35m' $'\C-[[31m' $'\C-[[38;5;27m' $'\C-[[36m' $'\C-[[38;5;100m' $'\C-[[38;5;98m' $'\C-[[91m' $'\C-[[38;5;80m' $'\C-[[92m' $'\C-[[38;5;214m' $'\C-[[38;5;165m' $'\C-[[38;5;124m' $'\C-[[38;5;120m'
ignore
:fzf-tab:* false
ignored-patterns
:completion:*:*:*:users adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp usbmux uucp vcsa wwwrun xfs '_*'
insert-space
:fzf-tab:* true
list-colors
:completion:*:*:kill:*:processes '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
:completion:* ''
list-grouped
:completion:* false
matcher-list
:completion:* 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
menu
:completion:*:*:*:*:* select
no-group-color
:fzf-tab:* $'\C-[[37m'
prefix
:fzf-tab:*
query-string
:fzf-tab:* prefix input first
show-group
:fzf-tab:* full
single-group
:fzf-tab:* color header
single-ignored
* show
special-dirs
:completion:* true
tag-order
:completion:*:cd:* local-directories directory-stack path-directories
use-cache
:completion::complete:* 1
hmank ~ »
Thanks for your help. I have fixed it. Please update and check again.
If you don't have other questions I will close this issue, because the feature you request can be implmented by zstyle ':completion:*' matcher-list 'b:=*'
.
Maybe it's a little annoying as I report again. But I found fzf-tab
need press twice TAB
to show it. Default zsh only need once TAB
.
Need twice TAB
the first time complete command ce
. Then only once TAB
needed for both ce
and ce coc
.
How about other commands? All of them need press TAB twice? What's your OS and zsh version? Are you a macOS user?
And please provide the output of which _main_complete
and which _fzf_tab__main_complete
before you press TAB.
No, seems only for the first time trigger cheat
, ls, cd, vim, python
will trigger fzf
the first time press TAB
.
Using Manjaro 19.0.2, zsh 5.8.
hmank ~ » which _main_complete
_main_complete () {
_fzf_tab_complete
}
hmank ~ » which _fzf_tab__main_complete
_fzf_tab__main_complete () {
local IFS=$' \t\n\0'
eval "$_comp_setup"
local func funcs ret=1 tmp _compskip format nm call match min max i num _completers _completer _completer_num curtag _comp_force_list _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg mesg str context state state_descr line opt_args val_args curcontext="$curcontext" _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel _tags_level=0 _saved_exact="${compstate[exact]}" _saved_lastprompt="${compstate[last_prompt]}" _saved_list="${compstate[list]}" _saved_insert="${compstate[insert]}" _saved_colors="$ZLS_COLORS" _saved_colors_set=${+ZLS_COLORS} _ambiguous_color=''
local _comp_priv_prefix
unset _comp_priv_prefix
local -a precommands
local -ar builtin_precommands=(- builtin eval exec nocorrect noglob time)
typeset -U _lastdescr _comp_ignore _comp_colors
{
[[ -z "$curcontext" ]] && curcontext=:::
zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=yes
if [[ ( "$tmp" = *pending(|[[:blank:]]*) && PENDING -gt 0 ) || ( "$tmp" = *pending=(#b)([0-9]##)(|[[:blank:]]*) && PENDING -ge $match[1] ) ]]
then
compstate[insert]=tab
return 0
fi
if [[ "$compstate[insert]" = tab* ]]
then
if [[ "$tmp" = (|*[[:blank:]])(yes|true|on|1)(|[[:blank:]]*) ]]
then
if [[ "$curcontext" != :* || -z "$compstate[vared]" ]] || zstyle -t ":completion:vared${curcontext}:" insert-tab
then
return 0
fi
fi
compstate[insert]="${compstate[insert]//tab /}"
fi
if [[ "$compstate[pattern_match]" = "*" && "$_lastcomp[unambiguous]" = "$PREFIX" && -n "$_lastcomp[unambiguous_cursor]" ]]
then
integer upos="$_lastcomp[unambiguous_cursor]"
SUFFIX="$PREFIX[upos,-1]$SUFFIX"
PREFIX="$PREFIX[1,upos-1]"
fi
if [[ -z "$compstate[quote]" ]]
then
if [[ -o equals ]] && compset -P 1 '='
then
compstate[context]=equal
elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]
then
compset -p 1
compstate[context]=tilde
fi
fi
_setup default
_def_menu_style=("$_last_menu_style[@]")
_last_menu_style=()
if zstyle -s ":completion:${curcontext}:default" list-prompt tmp
then
LISTPROMPT="$tmp"
zmodload -i zsh/complist
fi
if zstyle -s ":completion:${curcontext}:default" select-prompt tmp
then
MENUPROMPT="$tmp"
zmodload -i zsh/complist
fi
if zstyle -s ":completion:${curcontext}:default" select-scroll tmp
then
MENUSCROLL="$tmp"
zmodload -i zsh/complist
fi
if (( $# ))
then
if [[ "$1" = - ]]
then
if [[ $# -lt 3 ]]
then
_completers=()
else
_completers=("$2")
call=yes
fi
else
_completers=("$@")
fi
else
zstyle -a ":completion:${curcontext}:" completer _completers || _completers=(_complete _ignored)
fi
_completer_num=1
integer SECONDS=0
TRAPINT () {
zle -M "Killed by signal in ${funcstack[2]} after ${SECONDS}s"
zle -R
return 130
}
TRAPQUIT () {
zle -M "Killed by signal in ${funcstack[2]} after ${SECONDS}s"
zle -R
return 131
}
funcs=("$compprefuncs[@]")
compprefuncs=()
for func in "$funcs[@]"
do
"$func"
done
for tmp in "$_completers[@]"
do
if [[ -n "$call" ]]
then
_completer="${tmp}"
elif [[ "$tmp" = *:-* ]]
then
_completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}"
tmp="${tmp%:*}"
elif [[ $tmp = *:* ]]
then
_completer="${tmp#*:}"
tmp="${tmp%:*}"
else
_completer="${tmp[2,-1]//_/-}"
fi
curcontext="${curcontext/:[^:]#:/:${_completer}:}"
zstyle -t ":completion:${curcontext}:" show-completer && zle -R "Trying completion for :completion:${curcontext}"
zstyle -a ":completion:${curcontext}:" matcher-list _matchers || _matchers=('')
_matcher_num=1
_matcher=''
for _c_matcher in "$_matchers[@]"
do
if [[ "$_c_matcher" == +* ]]
then
_matcher="$_matcher $_c_matcher[2,-1]"
else
_matcher="$_c_matcher"
fi
_comp_mesg=
if [[ -n "$call" ]]
then
if "${(@)argv[3,-1]}"
then
ret=0
break 2
fi
elif "$tmp"
then
ret=0
break 2
fi
(( _matcher_num++ ))
done
[[ -n "$_comp_mesg" ]] && break
(( _completer_num++ ))
done
curcontext="${curcontext/:[^:]#:/::}"
if [[ $compstate[old_list] = keep ]]
then
nm=$_lastcomp[nmatches]
else
nm=$compstate[nmatches]
fi
if [[ $compstate[old_list] = keep || nm -gt 1 ]]
then
[[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] && _menu_style=("$_last_menu_style[@]" "$_menu_style[@]")
tmp=$(( compstate[list_lines] + BUFFERLINES + 1 ))
_menu_style=("$_menu_style[@]" "$_def_menu_style[@]")
if [[ "$compstate[list]" = *list && tmp -gt LINES && ( -n "$_menu_style[(r)select=long-list]" || -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]
then
compstate[insert]=menu
elif [[ "$compstate[insert]" = "$_saved_insert" ]]
then
if [[ -n "$compstate[insert]" && -n "$_menu_style[(r)(yes|true|1|on)=long]" && tmp -gt LINES ]]
then
compstate[insert]=menu
else
sel=("${(@M)_menu_style:#(yes|true|1|on)*}")
if (( $#sel ))
then
min=9999999
for i in "$sel[@]"
do
if [[ "$i" = *\=[0-9]* ]]
then
num="${i#*\=}"
[[ num -lt 0 ]] && num=0
elif [[ "$i" != *\=* ]]
then
num=0
else
num=9999999
fi
[[ num -lt min ]] && min="$num"
(( min )) || break
done
fi
sel=("${(@M)_menu_style:#(no|false|0|off)*}")
if (( $#sel ))
then
max=9999999
for i in "$sel[@]"
do
if [[ "$i" = *\=[0-9]* ]]
then
num="${i#*\=}"
[[ num -lt 0 ]] && num=0
elif [[ "$i" != *\=* ]]
then
num=0
else
num=9999999
fi
[[ num -lt max ]] && max="$num"
(( max )) || break
done
fi
if [[ ( -n "$min" && nm -ge min && ( -z "$max" || nm -lt max ) ) || ( -n "$_menu_style[(r)auto*]" && "$compstate[insert]" = automenu ) ]]
then
compstate[insert]=menu
elif [[ -n "$max" && nm -ge max ]]
then
compstate[insert]=unambiguous
elif [[ -n "$_menu_style[(r)auto*]" && "$compstate[insert]" != automenu ]]
then
compstate[insert]=automenu-unambiguous
fi
fi
fi
if [[ "$compstate[insert]" = *menu* ]]
then
[[ "$MENUSELECT" = 00 ]] && MENUSELECT=0
if [[ -n "$_menu_style[(r)no-select*]" ]]
then
unset MENUSELECT
elif [[ -n "$_menu_style[(r)select=long*]" ]]
then
if [[ tmp -gt LINES ]]
then
zmodload -i zsh/complist
MENUSELECT=00
fi
fi
if [[ "$MENUSELECT" != 00 ]]
then
sel=("${(@M)_menu_style:#select*}")
if (( $#sel ))
then
min=9999999
for i in "$sel[@]"
do
if [[ "$i" = *\=[0-9]* ]]
then
num="${i#*\=}"
[[ num -lt 0 ]] && num=0
elif [[ "$i" != *\=* ]]
then
num=0
else
num=9999999
fi
[[ num -lt min ]] && min="$num"
(( min )) || break
done
zmodload -i zsh/complist
MENUSELECT="$min"
else
unset MENUSELECT
fi
fi
if [[ -n "$MENUSELECT" ]]
then
if [[ -n "$_menu_style[(r)interactive*]" ]]
then
MENUMODE=interactive
elif [[ -n "$_menu_style[(r)search*]" ]]
then
if [[ -n "$_menu_style[(r)*backward*]" ]]
then
MENUMODE=search-backward
else
MENUMODE=search-forward
fi
else
unset MENUMODE
fi
fi
fi
elif [[ nm -lt 1 && -n "$_comp_mesg" ]]
then
compstate[insert]=''
compstate[list]='list force'
elif [[ nm -eq 0 && -z "$_comp_mesg" && $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] && zstyle -s ":completion:${curcontext}:warnings" format format
then
compstate[list]='list force'
compstate[insert]=''
tmp=("\`${(@)^_lastdescr:#}'")
case $#tmp in
(1) str="$tmp[1]" ;;
(2) str="$tmp[1] or $tmp[2]" ;;
(*) str="${(j:, :)tmp[1,-2]}, or $tmp[-1]" ;;
esac
_setup warnings
zformat -f mesg "$format" "d:$str" "D:${(F)${(@)_lastdescr:#}}"
compadd -x "$mesg"
fi
if [[ -n "$_ambiguous_color" ]]
then
local toquote='[=\(\)\|~^?*[\]#<>]'
local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
[[ -n $prefix ]] && _comp_colors+=("=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$_ambiguous_color")
fi
[[ "$_comp_force_list" = always || ( "$_comp_force_list" = ?* && nm -ge _comp_force_list ) ]] && compstate[list]="${compstate[list]//messages} force"
} always {
if [[ "$compstate[old_list]" = keep ]]
then
if [[ $_saved_colors_set = 1 ]]
then
ZLS_COLORS="$_saved_colors"
else
unset ZLS_COLORS
fi
elif (( $#_comp_colors ))
then
ZLS_COLORS="${(j.:.)_comp_colors}"
else
unset ZLS_COLORS
fi
}
funcs=("$comppostfuncs[@]")
comppostfuncs=()
for func in "$funcs[@]"
do
"$func"
done
_lastcomp=("${(@kv)compstate}")
_lastcomp[nmatches]=$nm
_lastcomp[completer]="$_completer"
_lastcomp[prefix]="$PREFIX"
_lastcomp[suffix]="$SUFFIX"
_lastcomp[iprefix]="$IPREFIX"
_lastcomp[isuffix]="$ISUFFIX"
_lastcomp[qiprefix]="$QIPREFIX"
_lastcomp[qisuffix]="$QISUFFIX"
_lastcomp[tags]="$_comp_tags"
return ret
}
hmank ~ »
Please eval the code below before you press TAB, and then input ce
and press TAB and attach the content of /tmp/fzf-tab-debug.txt
select-first() {
read input
echo $input
}
zstyle ':fzf-tab:*' command select-first
fzf-tab-debug() {
local -i debug_fd=1
exec {debug_fd}>&2 2>|/tmp/fzf-tab-debug.txt
setopt xtrace
local -i _fzf_tab_continue=1
while (( _fzf_tab_continue )); do
_fzf_tab_continue=0
IN_FZF_TAB=1
{
zle .fzf-tab-orig-$_fzf_tab_orig_widget
} always {
IN_FZF_TAB=0
}
zle redisplay
done
unsetopt xtrace
}
zle -N fzf-tab-debug
bindkey "^I" fzf-tab-debug
+fzf-tab-debug:4> local -i _fzf_tab_continue=1
+fzf-tab-debug:5> (( _fzf_tab_continue ))
+fzf-tab-debug:6> _fzf_tab_continue=0
+fzf-tab-debug:7> IN_FZF_TAB=1
+fzf-tab-debug:9> zle .fzf-tab-orig-expand-or-complete
+fzf-tab-debug:11> IN_FZF_TAB=0
+fzf-tab-debug:13> zle redisplay
+fzf-tab-debug:5> (( _fzf_tab_continue ))
+fzf-tab-debug:15> unsetopt xtrace
what's the output of which $widgets[.fzf-tab-orig-expand-or-complete]
( of course, before press TAB )
hmank ~ » which $widgets[.fzf-tab-orig-expand-or-complete]
user:_zsh_highlight_widget_orig-s0.0000040000-r11132-expand-or-complete not found
Can't found even after press TAB
.
NOTE: fzf-tab needs to be sourced after
compinit
, but before plugins which will wrap widgets like zsh-autosuggestions or fast-syntax-highlighting.
Make sure fzf-tab is loaded before zsh-syntax-highlighting. echo $widgets[.fzf-tab-orig-expand-or-complete]
should be something like completion:.expand-or-complete:_main_complete
or your custom zle widget.
Oh! I was so careless. But for now got:
hmank ~ » which $widgets[.fzf-tab-orig-expand-or-complete]
completion:.expand-or-complete:_main_complete not found
hmank ~ » which _main_complete
_main_complete () {
_fzf_tab_complete
}
hmank ~ »
That doesn't matter. Do you still need to press TAB twice to trigger completion?
If so, please do this again: https://github.com/Aloxaf/fzf-tab/issues/67#issuecomment-604183937
Yeah, still need to press TAB
twice.
+fzf-tab-debug:4> local -i _fzf_tab_continue=1
+fzf-tab-debug:5> (( _fzf_tab_continue ))
+fzf-tab-debug:6> _fzf_tab_continue=0
+fzf-tab-debug:7> IN_FZF_TAB=1
+fzf-tab-debug:9> zle .fzf-tab-orig-expand-or-complete
+_main_complete:0> _fzf_tab_complete
+_fzf_tab_complete:1> local -a _fzf_tab_compcap
+_fzf_tab_complete:2> local -Ua _fzf_tab_groups
+_fzf_tab_complete:3> local choice choices _fzf_tab_curcontext continuous_trigger bs=$'\C-B'
+_fzf_tab_complete:5> _fzf_tab__main_complete
+_fzf_tab__main_complete:1> local IFS=$' \t\n\C-@'
+_fzf_tab__main_complete:2> eval $'local -A _comp_caller_options;\n _comp_caller_options=(${(kv)options[@]});\n setopt localoptions localtraps localpatterns ${_comp_options[@]};\n local IFS=$\' \\t\\r\\n\\0\';\n builtin enable -p \\| \\~ \\( \\? \\* \\[ \\< \\^ \\# 2>&-;\n exec </dev/null;\n trap - ZERR;\n local -a reply;\n local REPLY;\n local REPORTTIME;\n unset REPORTTIME'
+(eval):1> local -A _comp_caller_options
+(eval):2> _comp_caller_options=( posixargzero off autolist on printexitvalue off kshzerosubscript off histreduceblanks off chaselinks off extendedglob off localloops off histnostore off automenu on globcomplete off unset on listpacked off promptsubst on shwordsplit off pathdirs off kshtypeset off listtypes on warncreateglobal off promptbang off dotglob off braceexpand on listbeep on correctall off privileged off numericglobsort off histverify on trackall on histsubstpattern off globstarshort off cbases off rcquotes off posixaliases off histfindnodups off bashautolist off sharehistory on overstrike off kshautoload off incappendhistory on appendcreate off promptcr on mailwarn off pushdignoredups on interactive on ignoreeof off globsubst off rematchpcre off monitor on histsavebycopy on histbeep on debugbeforecmd on magicequalsubst off rmstarsilent off posixjobs off hashcmds on posixtraps off extendedhistory on notify on kshoptionprint off histexpiredupsfirst on glob on posixcd off braceccl off badpattern on longlistjobs off banghist on dvorak off alwaystoend on hashall on warnnestedvar off globalexport on ksharrays off correct off cdsilent off autonamedirs off histexpand on typesetsilent off rmstarwait off histnofunctions off autoparamslash on trapsasync off sunkeyboardhack off promptsp on histsavenodups off autocd on allexport off posixidentifiers off cshjunkiehistory off autopushd on completeinword on completealiases off aliases on autocontinue off appendhistory on aliasfuncdef off singlelinezle off hashlistall on ignoreclosebraces off recexact off localoptions off interactivecomments off errexit off cshjunkiequotes off markdirs off hashdirs on cdablevars off rcexpandparam off vi off printeightbit off multifuncdef on xtrace on login off cshjunkieloops off histappend on histignorespace on evallineno on shfileexpansion off rcs on functionargzero on errreturn off combiningchars off histignoredups on histfcntllock off beep on autoremoveslash on hup on globdots off checkrunningjobs on autoparamkeys on shnullcmd off multibyte on zle on promptpercent on flowcontrol off continueonerror off incappendhistorytime off autoresume off globassign off caseglob on shortloops on bsdecho off cprecedences off log on transientrprompt off verbose off localpatterns off ignorebraces off pipefail off equals on menucomplete off cshnullglob off casematch on promptvars on histallowclobber off bareglobqual on shinstdin on restricted off pushdminus on nullglob off chasedots off mailwarning off listambiguous on cshnullcmd off bashrematch off octalzeroes off forcefloat off exec on multios on emacs off nomatch on pathscript off localtraps off stdin on onecmd off kshglob off clobber on posixbuiltins off alwayslastprompt on pushdtohome off histignorealldups off hashexecutablesonly off pushdsilent off shoptionletters off physical off sourcetrace off histlexwords off bgnice on globalrcs on posixstrings off checkjobs on shglob off singlecommand off listrowsfirst off )
+(eval):3> setopt localoptions localtraps localpatterns bareglobqual extendedglob glob multibyte multifuncdef nullglob rcexpandparam unset NO_allexport NO_aliases NO_cshnullglob NO_cshjunkiequotes NO_errexit NO_errreturn NO_globassign NO_globsubst NO_histsubstpattern NO_ignorebraces NO_ignoreclosebraces NO_kshglob NO_ksharrays NO_kshtypeset NO_markdirs NO_octalzeroes NO_posixbuiltins NO_posixidentifiers NO_shwordsplit NO_shglob NO_warnnestedvar NO_warncreateglobal
+(eval):4> local IFS=$' \t\C-M\n\C-@'
+(eval):5> enable -p '|' '~' '(' '?' '*' '[' '<' '^' '#'
+(eval):7> trap - ZERR
+(eval):8> local -a reply
+(eval):9> local REPLY
+(eval):10> local REPORTTIME
+(eval):11> unset REPORTTIME
+_fzf_tab__main_complete:3> local func funcs ret=1 tmp _compskip format nm call match min max i num _completers _completer _completer_num curtag _comp_force_list _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg mesg str context state state_descr line opt_args val_args curcontext='' _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel _tags_level=0 _saved_exact='' _saved_lastprompt=yes _saved_list=ambiguous _saved_insert=automenu-unambiguous _saved_colors='' _saved_colors_set=0 _ambiguous_color=''
+_fzf_tab__main_complete:4> local _comp_priv_prefix
+_fzf_tab__main_complete:5> unset _comp_priv_prefix
+_fzf_tab__main_complete:6> local -a precommands
+_fzf_tab__main_complete:7> local -ar builtin_precommands=( - builtin eval exec nocorrect noglob time )
+_fzf_tab__main_complete:8> typeset -U _lastdescr _comp_ignore _comp_colors
+_fzf_tab__main_complete:10> [[ -z '' ]]
+_fzf_tab__main_complete:10> curcontext=:::
+_fzf_tab__main_complete:11> zstyle -s :completion::::: insert-tab tmp
+_fzf_tab__main_complete:11> tmp=yes
+_fzf_tab__main_complete:12> [[ yes = *pending(|[[:blank:]]*) || yes = *pending=(#b)([0-9]##)(|[[:blank:]]*) ]]
+_fzf_tab__main_complete:17> [[ automenu-unambiguous = tab* ]]
+_fzf_tab__main_complete:28> [[ '' = \* ]]
+_fzf_tab__main_complete:34> [[ -z '' ]]
+_fzf_tab__main_complete:36> [[ -o equals ]]
+_fzf_tab__main_complete:36> compset -P 1 '='
+_fzf_tab__main_complete:39> [[ '' != */* && '' = \~ ]]
+_fzf_tab__main_complete:45> _setup default
+_setup:3> local val nm=0
+_setup:5> [[ 1 -eq 1 ]]
+_setup:5> 2=default
+_setup:7> zstyle -a :completion:::::default list-colors val
+_setup:8> zmodload -i zsh/complist
+_setup:9> [[ default = default ]]
+_setup:10> _comp_colors=( '' )
+_setup:27> zstyle -s :completion:::::default show-ambiguity val
+_setup:32> zstyle -t :completion:::::default list-packed
+_setup:34> [[ 2 -eq 1 ]]
+_setup:37> compstate[list]=ambiguous
+_setup:40> zstyle -t :completion:::::default list-rows-first
+_setup:42> [[ 2 -eq 1 ]]
+_setup:45> compstate[list]=ambiguous
+_setup:48> zstyle -t :completion:::::default last-prompt
+_setup:50> [[ 2 -eq 1 ]]
+_setup:53> compstate[last_prompt]=yes
+_setup:56> zstyle -t :completion:::::default accept-exact
+_setup:58> [[ 2 -eq 1 ]]
+_setup:61> compstate[exact]=''
+_setup:64> [[ _last_nmatches -ge 0 ]]
+_setup:67> zstyle -a :completion:::::default menu val
+_setup:68> _last_nmatches=0
+_setup:69> _last_menu_style=( select )
+_setup:74> [[ '' != always ]]
+_setup:75> zstyle -s :completion:::::default force-list val
+_fzf_tab__main_complete:46> _def_menu_style=( select )
+_fzf_tab__main_complete:47> _last_menu_style=( )
+_fzf_tab__main_complete:48> zstyle -s :completion:::::default list-prompt tmp
+_fzf_tab__main_complete:53> zstyle -s :completion:::::default select-prompt tmp
+_fzf_tab__main_complete:58> zstyle -s :completion:::::default select-scroll tmp
+_fzf_tab__main_complete:63> (( 0 ))
+_fzf_tab__main_complete:78> zstyle -a :completion::::: completer _completers
+_fzf_tab__main_complete:78> _completers=( _complete _ignored )
+_fzf_tab__main_complete:80> _completer_num=1
+_fzf_tab__main_complete:81> integer SECONDS=0
+_fzf_tab__main_complete:92> funcs=( )
+_fzf_tab__main_complete:93> compprefuncs=( )
+_fzf_tab__main_complete:98> tmp=_complete
+_fzf_tab__main_complete:100> [[ -n '' ]]
+_fzf_tab__main_complete:103> [[ _complete = *:-* ]]
+_fzf_tab__main_complete:107> [[ _complete = *:* ]]
+_fzf_tab__main_complete:112> _completer=complete
+_fzf_tab__main_complete:114> curcontext=:complete::
+_fzf_tab__main_complete:115> zstyle -t :completion::complete::: show-completer
+_fzf_tab__main_complete:116> zstyle -a :completion::complete::: matcher-list _matchers
+_fzf_tab__main_complete:117> _matcher_num=1
+_fzf_tab__main_complete:118> _matcher=''
+_fzf_tab__main_complete:119> _c_matcher=m:{a-zA-Z}={A-Za-z}
+_fzf_tab__main_complete:121> [[ 'm:{a-zA-Z}={A-Za-z}' == +* ]]
+_fzf_tab__main_complete:125> _matcher='m:{a-zA-Z}={A-Za-z}'
+_fzf_tab__main_complete:127> _comp_mesg=''
+_fzf_tab__main_complete:128> [[ -n '' ]]
+_fzf_tab__main_complete:135> _complete
+_complete:7> local comp name oldcontext ret=1 service
+_complete:8> typeset -T curcontext=:complete:: ccarray
+_complete:10> oldcontext=:complete::
+_complete:14> [[ -n '' ]]
+_complete:96> comp=_first
+_complete:97> [[ -n _first ]]
+_complete:98> service=-first-
+_complete:99> ccarray[3]=-first-
+_complete:100> eval _first
+(eval):1> _first
+_complete:100> ret=0
+_complete:101> [[ '' = all ]]
+_complete:110> [[ -n '' ]]
+_complete:114> ret=1
+_complete:115> [[ command = command ]]
+_complete:116> curcontext=:complete::
+_complete:117> _normal -s
+_normal:3> local _comp_command1 _comp_command2 _comp_command precommand
+_normal:4> local -A opts
+_normal:6> zparseopts -A opts -D - P 'p+:-=precommand' s
+_normal:7> (( 1 ))
+_normal:8> (( 0 ))
+_normal:9> (( 0 ))
+_normal:15> [[ -o BANG_HIST && '' = !*: || '' = "!*: ]]
+_normal:28> [[ CURRENT -eq 1 ]]
+_normal:37> _set_command
+_set_command:6> local command
+_set_command:8> command=cheat
+_set_command:10> [[ -z cheat ]]
+_set_command:12> (( 0 + 0 ))
+_set_command:15> [[ c = \= ]]
+_set_command:19> [[ cheat = ..#/* ]]
+_set_command:23> [[ cheat = */* ]]
+_set_command:28> _comp_command1=cheat
+_set_command:29> _comp_command2=/usr/bin/cheat
+_set_command:30> _comp_command=cheat
+_normal:39> _dispatch -s cheat cheat /usr/bin/cheat -default-
+_dispatch:3> local comp pat val name i ret=1 _compskip=''
+_dispatch:4> local curcontext=:complete:: service str noskip
+_dispatch:5> local -a match mbegin mend
+_dispatch:9> [[ -s = -s ]]
+_dispatch:10> noskip=yes
+_dispatch:11> shift
+_dispatch:14> [[ -z yes ]]
+_dispatch:16> curcontext=:complete:cheat:
+_dispatch:18> shift
+_dispatch:22> [[ '' != (all|*patterns*) ]]
+_dispatch:24> str=cheat
+_dispatch:25> [[ -n cheat ]]
+_dispatch:26> service=cheat
+_dispatch:24> str=/usr/bin/cheat
+_dispatch:25> [[ -n /usr/bin/cheat ]]
+_dispatch:26> service=/usr/bin/cheat
+_dispatch:24> str=-default-
+_dispatch:25> [[ -n -default- ]]
+_dispatch:26> service=-default-
+_dispatch:45> ret=1
+_dispatch:46> str=cheat
+_dispatch:47> [[ -n cheat ]]
+_dispatch:51> str=cheat
+_dispatch:52> name=cheat
+_dispatch:53> comp=_cheat
+_dispatch:54> service=cheat
+_dispatch:56> [[ -z _cheat ]]
+_dispatch:56> break
+_dispatch:61> [[ -n _cheat && cheat != -default- ]]
+_dispatch:62> _compskip=patterns
+_dispatch:63> eval _cheat
+(eval):1> _cheat
+_cheat:3> local -a cheats
+_cheat:4> cheats=( )
+_dispatch:63> ret=0
+_dispatch:64> [[ patterns = (all|*patterns*) ]]
+_dispatch:64> return ret
+_complete:117> ret=0
+_complete:142> _compskip=''
+_complete:144> return ret
+_fzf_tab__main_complete:137> ret=0
+_fzf_tab__main_complete:138> break 2
+_fzf_tab__main_complete:145> curcontext=:::
+_fzf_tab__main_complete:146> [[ '' = keep ]]
+_fzf_tab__main_complete:150> nm=0
+_fzf_tab__main_complete:152> [[ '' = keep || nm -gt 1 ]]
+_fzf_tab__main_complete:277> [[ nm -lt 1 && -n '' ]]
+_fzf_tab__main_complete:281> [[ nm -eq 0 && -z '' && 0 -ne 0 ]]
+_fzf_tab__main_complete:295> [[ -n '' ]]
+_fzf_tab__main_complete:301> [[ '' = always || '' = ?* ]]
+_fzf_tab__main_complete:303> [[ '' = keep ]]
+_fzf_tab__main_complete:311> (( 1 ))
+_fzf_tab__main_complete:313> ZLS_COLORS=''
+_fzf_tab__main_complete:318> funcs=( )
+_fzf_tab__main_complete:319> comppostfuncs=( )
+_fzf_tab__main_complete:324> _lastcomp=( list_lines 0 all_quotes '\' nmatches 0 restore auto context command vared '' unambiguous '' list_max 100 unambiguous_cursor 1 list ambiguous insert_positions '' unambiguous_positions '' exact '' to_end match last_prompt yes pattern_insert menu ignored 0 insert automenu-unambiguous )
+_fzf_tab__main_complete:325> _lastcomp[nmatches]=0
+_fzf_tab__main_complete:326> _lastcomp[completer]=complete
+_fzf_tab__main_complete:327> _lastcomp[prefix]=''
+_fzf_tab__main_complete:328> _lastcomp[suffix]=''
+_fzf_tab__main_complete:329> _lastcomp[iprefix]=''
+_fzf_tab__main_complete:330> _lastcomp[isuffix]=''
+_fzf_tab__main_complete:331> _lastcomp[qiprefix]=''
+_fzf_tab__main_complete:332> _lastcomp[qisuffix]=''
+_fzf_tab__main_complete:333> _lastcomp[tags]=''
+_fzf_tab__main_complete:334> return ret
+_fzf_tab_complete:7> emulate -L zsh -o extended_glob
+_fzf_tab_complete:9> local query candidates=( ) headers=( ) command opts
+_fzf_tab_complete:10> _fzf_tab_get_candidates
+_fzf_tab_get_candidates:1> local dsuf dpre k _v filepath first_word show_group no_group_color prefix bs=$'\C-H'
+_fzf_tab_get_candidates:2> local -a list_colors group_colors tcandidates
+_fzf_tab_get_candidates:3> local -i same_word=1 colorful=0
+_fzf_tab_get_candidates:4> local -Ua duplicate_groups=( )
+_fzf_tab_get_candidates:5> local -A word_map=( )
+_fzf_tab_get_candidates:7> (( 0 == 0 ))
+_fzf_tab_get_candidates:7> return
+_fzf_tab_complete:12> case 0 (0)
+_fzf_tab_complete:13> return
+fzf-tab-debug:11> IN_FZF_TAB=0
+fzf-tab-debug:13> zle redisplay
+fzf-tab-debug:5> (( _fzf_tab_continue ))
+fzf-tab-debug:15> unsetopt xtrace
Now it works! As I have forgot to call function _cheat
in file
/usr/share/zsh/site-functions/_cheat`(removed it yesterday). Sorry for that, and thanks a lot for your instructions!
Congratulations!
Is your feature request related to a problem? Please describe.
fzf-tab
shows result different with zsh default result.See, I use a terminal software as
cheat
, I aliasce
tocheat -e
. And I usecheat
created a filevim.com
,cheat -e vim.com
will open and edit it. In default zsh setting, if I inputce coc
, preseeTAB
, zsh will complete it toce vim.coc
.The follow gif show the result I discribed:
But if I toggle
fzf-tab
, after inputce coc
, pressTAB
, zsh will complete nothing. But if I inputce vim
pressTAB
, zsh will show all file prefix withvim
, I show it blowDescribe the solution you'd like
I expect
fzf-tab
showce vim.coc
after I inputce coc
and pressTAB
.