Hi, I want to try Neovim and am currently setting it up. I want an easier way to type or <C-[>, so I added these keymaps:
vim.keymap.set("", "<C-Space>", "<C-[>")
vim.keymap.set("!", "<C-Space>", "<C-[>")
But this does weird stuff: In insert, visual and normal mode it seems to work and pressing CTRL+Space brings me back to normal mode or does nothing. But when entering a colon-command, pressing CTRL+Space acts as if I had pressed Enter. When typing "r" (single character replace) and then CTRL+Space, it replaces the character by a space, as without the mapping.
The same applies when mapping other keys than instead (the terminal seems to send correctly), or when mapping to instead of <C-[>.
What's going on here and how can I get the mapping to work? Thanks for any help!
For the
rcase I think you need to set the mapping in "operator pending" mode, which you get by putting"o"in the same position you already have"!".I don't know what the issue is with command mode.
There is plenty of precedent for custom escape bindings, often using
jkorjj. You might be able to find examples to get an idea of the best way to set up those bindings.There might be an issue with
<C-space>in particular if it has existing mappings in certain modes. I know that auto-complete plugins often use that mapping to make the completions menu appear. There might be some interaction with that mapping specifically with plugins you're using, or with built-in behavior. I suggest experimenting with a different mapping to narrow down whether problems are due to the way you are writing mappings, or to a specific interaction with that key sequence.