fix(nvim): keep prompt icon when clearing input with cc/S#615
Open
KorigamiK wants to merge 2 commits into
Open
fix(nvim): keep prompt icon when clearing input with cc/S#615KorigamiK wants to merge 2 commits into
KorigamiK wants to merge 2 commits into
Conversation
In prompt_vim_mode the input bar is a prompt buffer whose prompt icon is protected text at the start of the line. A normal-mode cc/S deletes the whole line including the prompt, so Neovim re-inserts the icon as plain literal text that has to be backspaced out. Map cc and S to reset the line to just the prompt and re-enter insert at the right column, so clearing the query leaves the prompt intact.
dmtrKovalenko
approved these changes
Jun 18, 2026
| end | ||
| end) | ||
| end | ||
| set_keymap('n', 'cc', clear_query_line, input_opts) |
Owner
There was a problem hiding this comment.
we probably need remap=true here to be able to remap existing bindings of cc
Author
There was a problem hiding this comment.
Cool, I've updated this for the cc/S mappings so existing user remaps still resolve.
Pass remap=true so existing user mappings of cc/S still resolve through our handler, per review feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #614.
With
prompt_vim_mode = true, clearing the query from normal mode withcc/Sleft a stray prompt icon behind that had to be backspaced out.The input bar is a
buftype=promptbuffer whose prompt icon is protected text at the start of the line.cc/Sdelete the whole line including the prompt, so Neovim re-inserts the icon as plain literal text.Fix
In
prompt_vim_mode, mapccandSto reset the line to just the prompt and re-enter insert at the correct column. Clearing the query now leaves the prompt intact, and the resulting empty-query search runs as normal.Testing
ccandSfrom normal mode inprompt_vim_modeclear the query and keep the prompt icon, with the cursor placed right after it in insert mode.