26

I'm using lsp-mode, and I see these weird prefix commands that start with s-l. How do I type them?

`lsp-mode' Minor Mode Bindings:
key             binding
---             -------

s-l             Prefix Command
C-S-SPC         lsp-signature-activate
<C-down-mouse-1>                lsp-find-definition-mouse
<C-mouse-1>                     ignore
<mouse-3>       lsp-mouse-click

s-l =           Prefix Command
s-l F           Prefix Command
s-l G           Prefix Command
s-l T           Prefix Command
s-l a           Prefix Command
s-l g           Prefix Command
s-l h           Prefix Command
s-l r           Prefix Command
s-l s           Prefix Command

s-l G g         lsp-ui-peek-find-definitions
Jim Hunziker
  • 425
  • 4
  • 6

2 Answers2

25

For historical reasons, Emacs supports key bindings for the 'super' and 'hyper' modifier keys, which you probably do not have on your keyboard. See Modifier Keys in the Emacs manual for more information.

So the key bindings you are looking at use super+l as a prefix.

You can simulate these additional keys with some built-it sequences:

C-x @ h adds the Hyper flag to the next character, C-x @ s adds the Super flag

Depending on your operating system, you may have built-in bindings (on a Mac, Super is the Command key) and can customize using appropriate variables (ns-*-modifier variables on Mac, w32-*-modifier variables on Windows). For example on a Mac you might have ns-command-modifier set to map Command to Super. See Windows Keyboard or Mac Basics for more.

glucas
  • 20,175
  • 1
  • 51
  • 83
  • I'm on Linux - I think Gnome is eating the super key when I press it. Is there a way to change `s-l` to something like `C-; l` for all these? I already have `C-;` set up as a prefix. – Jim Hunziker Jan 30 '20 at 18:26
  • 1
    Maybe something like `(define-key my-map (kbd "l") '(kbd "C-x @ s l"))`? – Jim Hunziker Jan 30 '20 at 18:27
  • 6
    Looks like lsp-mode provides a customization option for the prefix, so the easiest fix might be: `M-x customize-option lsp-keymap-prefix` and define your own. Or do it in your init file, e.g. `(setq lsp-keymap-prefix "C-c C-l")` or whatever. – glucas Jan 30 '20 at 18:29
  • 2
    I suggest configuring Gnome to ignore the super key (or at least restrict its uses to only what you need) so that you can take advantage of the super prefix in Emacs (where it's probably more useful to you). – phils Jan 30 '20 at 19:24
  • 5
    Customizing the `lsp-keymap-prefix` no longer works. Use `(define-key lsp-mode-map (kbd "C-c C-l") lsp-command-map))` instead as suggested here: https://github.com/emacs-lsp/lsp-mode/issues/1532 – LuGo Jun 08 '21 at 20:25
0

If you have a Windows keyboard, the Windows key is the super key.

Norman Ramsey
  • 1,113
  • 6
  • 13