-
Notifications
You must be signed in to change notification settings - Fork 722
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] Cancel completion and remove what was inserted #5278
Comments
The "cycle through completion candidates" keys ( Alternatively, the |
On Tue, Jan 21, 2025 at 07:45:11PM -0800, Screwtapello wrote:
The "cycle through completion candidates" keys (`<c-n>` and `<c-p>` by default) also cycle through the "no completion selected" state. So if you show the completion menu and press `<c-n>` to select the first completion, you can press `<c-p>` to go back to "no completion selected".
Alternatively, the `InsertCompletionHide` hook receives the list of inserted text ranges; you could create a custom "dismiss completions" mapping that adds a one-shot hook to delete the inserted text, then executes `<c-o>` to hide the completion menu.
Something like
hook global InsertCompletionHide .+ %{ exec <a-d> }
definitely works (it will delete all accepted completions).
You could make that deletion conditional on the `<esc>` key being pressed or similar.
|
That hook does not do anything for me. The main issue is I'm not sure how I would go about remove exactly what was inserted. |
yeah I forgot to select the inserted range. Below is a tested implementation that removes It seems to work fine; but messing with this kind of stuff could be a rabbit
|
Feature
If I choose a completion candidate but then decide I don't want to use it, I have to exit insert mode and delete whatever was inserted. It would be nice if I was able to hit some key to cancel the insertion and then delete whatever it inserted, if anything.
Usecase
No response
The text was updated successfully, but these errors were encountered: