I would like to bind a set of additional keys for spacemacs. The following statement is used:
(global-set-key (kbd "SPC-1") '(fzf/start "01-personal"))
yet it does not work that Emacs complains that SPC
is not a prefix key. Just wonder how spacemacs is able to do it. Did some searches, but didn't find the information for it. Can anyone help?
A more complete answer, is to first declare a prefix, and then set leader keys. For example:
(spacemacs/declare-prefix "o" "own-menu")
(spacemacs/set-leader-keys "os" 'ispell-buffer)
Using "o" as a prefix is a good idea, as it is guaranteed to be available for customization. Other prefixes might be used by different layers.
You can also add nested prefixes, for example I use the following to work with IDs in orgmode:
;; org-ids
(spacemacs/declare-prefix "od" "id")
(spacemacs/set-leader-keys "odc" 'org-id-copy)
(spacemacs/set-leader-keys "odu" 'org-id-update-id-locations)
Which allows me to press SPC o d c
to copy an Org header id (and create one if it doesn't already exist).
Just did some further search, the right way to set such keybinding under spacemacs is:
(spacemacs/set-leader-keys "1" 'keymap)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With