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

Prevent keymaps from overriding ssr's keymaps overrides #11

Open
chrisgrieser opened this issue Dec 6, 2022 · 11 comments
Open

Prevent keymaps from overriding ssr's keymaps overrides #11

chrisgrieser opened this issue Dec 6, 2022 · 11 comments

Comments

@chrisgrieser
Copy link
Contributor

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
Copy link
Contributor Author

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

@cshuaimin
Copy link
Owner

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

@chrisgrieser
Copy link
Contributor Author

0.8.0

@cshuaimin
Copy link
Owner

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

@chrisgrieser
Copy link
Contributor Author

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?

@cshuaimin
Copy link
Owner

You can freeze it to 4304933 for now.

@chrisgrieser
Copy link
Contributor Author

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

@cshuaimin
Copy link
Owner

cshuaimin commented Dec 27, 2022

@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?

@chrisgrieser
Copy link
Contributor Author

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

@cshuaimin
Copy link
Owner

<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.

@chrisgrieser
Copy link
Contributor Author

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.

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

No branches or pull requests

2 participants