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

[REQUEST] Manual trigger of completers #5279

Open
Supreeeme opened this issue Jan 22, 2025 · 5 comments
Open

[REQUEST] Manual trigger of completers #5279

Supreeeme opened this issue Jan 22, 2025 · 5 comments

Comments

@Supreeeme
Copy link

Feature

Currently, kakoune provides a way to manually trigger word and line completion, however you only seem to be able to toggle the autocompletion which uses the completers opt. I'd like the ability to manually trigger this completion as well.

Usecase

I prefer manual completion, i.e. how vim omnicomplete works. Toggling autocomplete on/off feels worse than just triggering manual completion whenever I feel like. This would also make the completers completion consistent with the manual triggering of word and line completion.

@krobelus
Copy link
Contributor

krobelus commented Jan 22, 2025 via email

@Supreeeme
Copy link
Author

Disabling autocomplete and using a hook does seem to work okay, however I still believe having this available by default would be consistent with the other forms of completion.

@krobelus
Copy link
Contributor

I still believe having this available by default would be consistent with the other forms of completion.

what behavior exactly?
I don't expect that "disabling autocomplete" will be fruitful -- if we do, completions will be used much less.

Or are you talking about a way to enable autocomplete, and automagically disable it again after accepting a completion?
I guess; but we need to figure out how this should work. It might be complex

@Supreeeme
Copy link
Author

I mean allowing to manually trigger completion that uses the completers, similar to how you can manually trigger word and line completion.

@krobelus
Copy link
Contributor

I'm not sure if that makes sense.
Note that <c-x> f will be invalidated as soon as you type anything.

The option=some_completions_opt completions are more powerful because they have a start offset, length and timestamp.
This allows you to type parts of the completion, and Kakoune filters and ranks completion candidates based on the "query" between start offset and cursor.
This is pretty nice. But it also means that it's not clearly defined when the completion should be invalidated.
I guess a potential <c-x> o could enable option completion until there is no more matching option..

To match your expectations, it is possible to define your own map global normal <c-x> %{:enter-user-mode my-ctrl-x<ret>},
where you can define your own command that enables option completion (via <c-o> or adding the option)

I'm not saying your expectation is wrong but it would add implementation complexity and UI problems that we'd want to solve.
autocompletion and explicit completers are two different animals.
If we can unify them in a way that simplifies things overall, that would be great but one would need to understand the differences first.

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

No branches or pull requests

2 participants