reddit / emacs

How do I set keymap prefix?

RedDeadAlice · 2022-04-09 14:45
I'm fairly new to Emacs and was following this guide : [https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/](https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/) After writing to the init file it says: >By default, lsp-mode's keybindings are available under s-l(Super-l), e. g. s-l h h will show documentation at point. You may change the default prefix by setting lsp-keymap-prefix. and that shortcut does conflict with my system's, so I wanted to make it something else, I've tried adding (setq lsp-keymap-prefix (kbd "s-z")) before and after the entering of lsp-mode, when added before it gave an error, and when added after s-z remained undefined, my init file doesn't contain anything other than the one mentioned in the link ​ SOLVED: here's how it should be done for lsp-keymap-prefix : [https://github.com/emacs-lsp/lsp-mode/issues/1532](https://github.com/emacs-lsp/lsp-mode/issues/1532)
unixbhaskar · 2022-04-09 14:59
Will this help: [https://www.emacswiki.org/emacs/PrefixKey](https://www.emacswiki.org/emacs/PrefixKey) ....I am hoping that you went through it, if you missed it, you can give it a glance.
RedDeadAlice · 2022-04-09 16:32
I've tried adding the following: (defun copy-s-l-to-s-z() (local-set-key (kbd "s-z") (lookup-key (current-local-map) (kbd "s-l")))) (with-eval-after-load 'lsp-mode (add-hook 'lsp-mode-hook #'copy-s-l-to-s-z)) And I still get "s-z is undefined" while I'm in lsp-mode Update: I've also tried this: (global-set-key (kbd "s-z") (lookup-key global-map (kbd "s-l"))) Same results