Reputation: 4848
I want to map the keystroke Ctrl + § to :Telescope oldfiles
in neovim. I naively tried this:
vim.keymap.set('n', '<C-§>', ':Telescope oldfiles<CR>', {noremap = true, silent = true })
but this doesn't work. This is my keyboard:
The keys I want to map are marked in red. How would I now go about finding out the correct "keymap string" I have to provide to nvim to recognise this combination?
Upvotes: 3
Views: 171
Reputation: 3710
I suspect you would have to use a Control Sequence Introducer (CSI) type sequence as the left-hand side (lhs
) mapping in your vim.keymap.set
command (see below for more info. on what lhs
is). However, at present, Neovim does not support CSI sequences as lhs
mappings. The enhancement request is currently being tracked under the issue #17108 on the Neovim GitHub repository.
To find out which sequence is being used inside your terminal, try one of the below, then press the key combination you desire and observe the output.
cat
Ctrl
+ v
showkey -a
Once you know the sequence, you'd then use this as the lhs
mapping in your vim.keymap.set
command if/when that enhancement is added.
lhs
and rhs
in the context of vim.keymap.set
refers to the the left- and right-hand side of the key mapping function's signature, respectively:
vim.keymap.set({mode}, {lhs}, {rhs}, {opts})
By using this function, one maps lhs
to rhs
: where lhs
is a string, and rhs
can be a string or a function.
Upvotes: 1