0

I'm trying to map my leader to <C-s> and local leader to <C-q>, in my NeoVim (0.5.0) init.lua file. I know Ctrl-S and Ctrl-Q are software flow control, and I mainly use the terminal version of nvim (but I'm happy to disable software flow control in the terminal emulator), but strangely this mapping doesn't work in graphical nvim-qt either?

This indirect mapping does work for as a leader:

vim.api.nvim_set_keymap(  ''  ,  '<C-s>'  ,  '<Leader>'  ,  {noremap = false}  )

But directly trying to set it, does not:

vim.g.mapleader = "<C-s>"

I've tried many variations such as \<C-s> and <C-S> but none seem to work when called via the vim.g.mapleader function. That said, if I do an echo mapleader it does show <C-s>, but none of the actual bindings work, they only work if I have set the leader indirectly...

If I use something conventional like these, then the mappings work...

vim.g.mapleader = " "
vim.g.mapleader = ","
vim.g.mapleader = "\\"

Any idea what is so special about trying to use mapleader with a Ctrl+Key combination?

1 Answer 1

1

Nevermind, after about a half hour playing around, I remembered the whole "prefix with <C-v> to enter 'special' characters" thing.

So, this works:

vim.g.mapleader = "^S"

But you don't enter that as literal text, instead you must literally type it as:

vim.g.mapleader = <C-V><C-S>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.