-
Notifications
You must be signed in to change notification settings - Fork 123
Add support of _approximate completer #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
`-U` flag causes bug when compleing parameter. But remove it will let _approximate won't work.
|
I don't know why the result of |
You can now use _approximate, but there is no fzf support. And a better stability.
|
I just tried to merge this on top of master. After resolving two obvious conflicts, this almost works, except tht if the _approximate completer is invoked, the captured prefix inserted into fzf contains a spurious I guess this is related to the games _approximate plays with compadd itself: if (( ! $+functions[compadd] ))
then
dounfunction=1
compadd () {
local ppre="$argv[(I)-p]"
[[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 && "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
if [[ "$PREFIX" = \~* && ( ppre -eq 0 || "$argv[ppre+1]" != \~* ) ]]
then
PREFIX="~(#a${_comp_correct})${PREFIX[2,-1]}"
else
PREFIX="(#a${_comp_correct})$PREFIX"
fi
(( $_correct_group && ${${argv[1,(r)-(|-)]}[(I)-*[JV]]} )) && _correct_expl[_correct_group]=${argv[1,(r)-(-|)][(R)-*[JV]]}
builtin compadd "$_correct_expl[@]" "$@"
}
fiAny ideas or pointers to start chasing? |
|
I added a dirtiest hack in intelfx@7f1d458 and _approximate seems to work reasonably with fzf-tab now. The only thing left is to maybe preselect the |
|
I wasn't aware of the 2020 attempt on the My current PR #554 follows the same general idea (keeping I'd appreciate it if you could try the new implementation. Your feedback would be especially helpful to catch any remaining edge cases. TL;DR:What the old approximate branch did (high level)
That approach mostly targeted the "compadd bypass" problem. It didn't handle the other conflicts that make _approximate fall back to the standard menu or insert wrong prefixes. How the current PR differs (high level)
|

Fix #56