0

I'm trying to create a shortcut, but I can't get vim to recognize my super key. I tried the following combinations:

lvim.keys.normal_mode["<A-h>"] = ":BufferLineCyclePrev<cr>"
lvim.keys.normal_mode["<A-l>"] = ":BufferLineCycleNext<cr>"

lvim.keys.normal_mode["<M-h>"] = ":BufferLineCyclePrev<cr>"
lvim.keys.normal_mode["<M-l>"] = ":BufferLineCycleNext<cr>"

lvim.keys.normal_mode["<D-h>"] = ":BufferLineCyclePrev<cr>"
lvim.keys.normal_mode["<D-l>"] = ":BufferLineCycleNext<cr>"

The above shortcuts work for Alt+h|l but not for Super+h|l.

I tried with running neovim in the termial (alacritty) and also with a graphical client (neovide)... without luck.

I use arch linux + xorg.

I have no problems with the super key in other apps.

Does anyone have an idea what I can do about this?

3
  • 2
    I don't know about the graphical clients, but most (as far as I know, all actually) terminals don't really recognize the Windows/"Super" key. It's just not something that's in the terminal text protocol. Although there are ways to work around this by configuring your WM to make Win+key send some specific key code you can pick up in Neovim, but it's a bit ugly and will only work on your system with that specifically configured WM. Apr 7 at 18:20
  • 1
    For neovide, I found this: github.com/neovide/neovide/wiki/Configuration#use-logo-key Apr 7 at 18:25
  • @MartinTournoij This was very helpful and you are right, alacritty could not recognize super. I didn't try neovide_input_use_logo for neovide, because a found a hack for alacritty, but this setting looks like a valid solution as well. Thanks!
    – Rotareti
    Apr 9 at 10:02

1 Answer 1

0

@Martin Tournoij was right, alacritty could not recognize the super key.

I ended up using this hacky solution.

With these key bindings in alacritty.yaml:

key_bindings:

 - { key: H,         mods: Super,       chars: "\x1bh"                       }
 - { key: L,         mods: Super,       chars: "\x1bl"                       }
 

I could make the Super key act like the Alt key for h and l, allowing me to use: <A-h> <A-l> in nvim.

More info on this hack: https://github.com/alacritty/alacritty/issues/62#issuecomment-347552058

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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