How to create a keyboard shortcut in Spacemacs

Let's jump into an example. If I want to pull up NeoTree every time I press SPACE o t, I add this to my .spacemacs user config:

(spacemacs/set-leader-keys "ot" 'neotree-toggle)

I then restart Spacemacs. I can now press SPACE o t:

shows the neotree-toggle option

and NeoTree appears:

shows neotree file manager on the left

So to add a shortcut, we find the name of the elisp function we'd like to call (e.g. neotree-toggle), and add a line to our .spacemacs file.

Will this shortcut override other shortcuts?

No, because SPACE o is reserved for user shortcuts.

Comments

Leave a comment

What color are green eyes? (spam prevention)
Submit
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.