How do I remap the lsp-mode prefix key to "s-k" using the use-package package?
I tried the following
(use-package lsp-mode
:ensure t
:init
(setq lsp-keymap-prefix (kbd "s-k")
(use-package
[...]
:bind
("s-k" . lsp-keymap-prefix)
(use-package
[...]
:bind (:map lsp-command-map
("s-k" . lsp-keymap-prefix))
I don't seem to understand how this works. What am I doing wrong?
EDIT 1: I am not sure if I should open a new issue for this. I followed the suggested solutions without success, when another issue occured:
Error (use-package): Failed to parse package lsp-mode: Wrong type argument: listp, lsp-keymap-prefix
Whene using emacs --debug-init, I get
Debugger entered--Lisp error: (void-variable personal-keybindings)
byte-code("\3061\247\0\307\310N\206\13\0\311\307\312\"\210\313\310N\206\26\0\311\313\10\"\210\313\310N\206!\0\311\313\11\"\210\314\315!\2042\0\316\315\317\320\321$\210..." [read-process-output-max lsp-idle-delay name key kmap kdesc (debug error) gc-cons-threshold custom-set set-default 100000000 setq fboundp lsp autoload "lsp-mode" nil t lsp-command-map add-hook c++-mode-hook "s-k" vectorp read-kbd-macro key-description lookup-key assoc add-to-list personal-keybindings define-key :catch global-map binding details entry err use-package--warning1] 6)
require(setup-lsp-mode)
eval-buffer(#<buffer *load*> nil "/home/nry/.emacs" nil t) ; Reading at buffer position 1076
load-with-code-conversion("/home/nry/.emacs" "/home/nry/.emacs" t t)
load("~/.emacs" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode 0x158e8a4509ed>) #f(compiled-function () #<bytecode 0x158e8a450a01>) t)
command-line()
normal-top-level()
After a little more investigations, it turns out that this happens every time I use :bind, I had to comment out the :bind- statements from other packages as well to get rid of the error message. This was not the case before I started to change the prefix key! All I did was playing around with the bind-statements, like
(setq lsp-keymap-prefix (kbd "s-k")
and
:bind
("s-k" . lsp-command-map) ;; not working
:bind-keymap
("s-k" . lsp-command-map)
I set everything back as it was, but the error message stays (if I use :bind in other packages like e.g. company). But it ONLY stays, if I byte compile my directory. If I only use the .el files, no error occurs. It feels like I broke my config or the use-package package. Any sugggestions?
EDIT 2: I found the solution to the issue describe in EDIT 1. I had to add
(eval-when-compile
(require 'use-package))
to my .emacs file. Also, changing the prefix-key was solved as well with:
:bind-keymap
("s-k" . lsp-command-map)
Cheers