ssr.nvim icon indicating copy to clipboard operation
ssr.nvim copied to clipboard

Prevent keymaps from overriding ssr's keymaps overrides

Open chrisgrieser opened this issue 2 years ago • 11 comments
trafficstars

I have this mapping for <CR>

keymap("n", "<CR>", "<C-^>")

When I now try to press <CR> in the ssr window, it tries to run <C-^> instead of triggering the replace from ssr. Checking the mappings also indicates that my global map seems to override ssr's map somehow?

Pasted image 2022-12-06 21 32 51

My current workaround is to simply use a different mapping via ssr's setup, but <CR> actually makes a lot of sense (and switching buffers does not work in the ssr window anyway).

chrisgrieser avatar Dec 06 '22 20:12 chrisgrieser

hmmm, I just tried removing my <CR> mapping, and I actually still get an error, when trying to replace_confirm, so this may be not (only) a keymap problem?

Pasted image 2022-12-06 21 46 30

chrisgrieser avatar Dec 06 '22 20:12 chrisgrieser

The error says there's no title key in nvim_open_win()'s argument. Which version of Neovim are you using?

cshuaimin avatar Dec 07 '22 02:12 cshuaimin

0.8.0

chrisgrieser avatar Dec 07 '22 03:12 chrisgrieser

Just found that it's only available on nightly (0.9)..

cshuaimin avatar Dec 07 '22 04:12 cshuaimin

Any chance to keep backwards compatibility with 0.8.0, at least for while 0.9.0 isn't fully published?

Automatically, which commit of ssr so works with 0.8.0, so I can freeze that version via packer?

chrisgrieser avatar Dec 07 '22 06:12 chrisgrieser

You can freeze it to 4304933853e66060ec03048b2ce3853c39c3886a for now.

cshuaimin avatar Dec 07 '22 09:12 cshuaimin

thanks. will report back on this issue on the 0.9.0 release

chrisgrieser avatar Dec 07 '22 11:12 chrisgrieser

@chrisgrieser hi the "invalid key title" issue should be fixed now.

As for <CR> mapping, ssr's mapping is a buffer local one, and should take precedence. I'm not sure what happened, what's your keymap function?

cshuaimin avatar Dec 27 '22 02:12 cshuaimin

yes, both issues seem to be fixed with the latest release!

Well, almost – while <CR> works fine now in the ssr main window, it still does not work in the small confirmation window

Pasted image 2022-12-27 15 19 55

chrisgrieser avatar Dec 27 '22 14:12 chrisgrieser

<CR> is not mapped in this confirmation window, you don't need to move cursor and press <CR>, just press one of y/n/a/q/l.

cshuaimin avatar Dec 29 '22 11:12 cshuaimin

ah I see. Thanks

Seeing that in most small windows like that, you can confirm a selection with <CR>, it might make sense to add that. Alternatively, you could make it clearer that the items are selected with keys by labelling them [y]es, [n]o, etc. Just from looking at the confirmation window, I would not have figured that out on my own.

chrisgrieser avatar Dec 29 '22 14:12 chrisgrieser