Skip to content
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

Add support of _approximate completer #57

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add support of _approximate completer #57

wants to merge 6 commits into from

Conversation

Aloxaf
Copy link
Owner

@Aloxaf Aloxaf commented Mar 10, 2020

Fix #56

@Aloxaf
Copy link
Owner Author

Aloxaf commented Mar 10, 2020

I don't know why the result of _approximate can't be inserted. This may take a long time, I will merge some useful changes to master.

Aloxaf added a commit that referenced this pull request Mar 10, 2020
You can now use _approximate, but there is no fzf support.
And a better stability.
@intelfx
Copy link

intelfx commented May 19, 2024

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 (#a<N>) prefix (apologies for screenshot, not sure how to capture fzf UI reasonably):

image

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[@]" "$@"
                        }
                fi

Any ideas or pointers to start chasing?

@intelfx
Copy link

intelfx commented May 19, 2024

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 [corrections] group if it exists — @Aloxaf, any ideas on what's happening here or how can I do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support _approximate completer
2 participants