Is there any possible way to remap these specific keys in neovim?
Ctrl+Shift+F5,
Ctrl+Shift+b,
Ctrl+Shift+
Ctrl+.
Alt+Enter
Is there any possible way to remap these specific keys in neovim?
Ctrl+Shift+F5,
Ctrl+Shift+b,
Ctrl+Shift+
Ctrl+.
Alt+Enter
Yes,
local map = vim.api.nvim_set_keymap
-- Various modifiers with F5
map('n', '<sc-f5>', [[<cmd>lua print('ctrl+shift+f5')<cr>]], {noremap = true})
map('n', '<c-f5>', [[<cmd>lua print('ctrl+f5')<cr>]], {noremap = true})
map('n', '<s-f5>', [[<cmd>lua print('shift+f5')<cr>]], {noremap = true})
map('n', '<a-f5>', [[<cmd>lua print('alt+f5')<cr>]], {noremap = true})
-- Ctrl+Shift+B
map('n', '<cs-B>', [[<cmd>lua print('ctrl+shift+b')<cr>]], {noremap = true})
-- Ctrl+Shift+=
map('n', '<c-+>', [[<cmd>lua print('ctrl+shift+=')<cr>]], {noremap = true})
-- Ctrl+=
map('n', '<c-=>', [[<cmd>lua print('ctrl+=')<cr>]], {noremap = true})
-- Ctrl+.
map('n', '<c-.>', [[<cmd>lua print('ctrl+.')<cr>]], {noremap = true})
-- Alt+Enter
map('n', '<a-cr>', [[<cmd>lua print('alt+enter')<cr>]], {noremap = true})
If you are using neovim in a terminal, you may have to override key bindings.
Example in Alacritty I had to add the following to its config so as to send the ANSI escape sequence instead of doing what it normally does when those key combinations are pressed.
key_bindings:
- {key: F5, mods: Control|Shift, chars: "\x1b[15;6;5~"}
- {key: F5, mods: Control, chars: "\x1b[>15;5~"}
- {key: F5, mods: Shift, chars: "\x1b[15;4~"}
- {key: F5, mods: Alt, chars: "\x1b[15;6~"}
- {key: B, mods: Control|Shift, chars: "\x1b[66;5u"}
- {key: Plus, mods: Control|Shift, chars: "\x1b[43;5u"}
- {key: Equals, mods: Control, chars: "\x1b[61;5u"}
- {key: Period, mods: Control, chars: "\x1b[46;5u"}
I’m also looking to remap the mappings in my bash ubuntu terminal so nvim can receive it but I’m not sure what’s it called in the ubuntu/gnomes terminology if it’s not something you just have to do with XKB
Is there a special word name for modifing the keymaps between the keyboard and bash so I can check how to do that on Ubuntu/Gnome?