Okay... Maybe the title was a little bit of a clickbait, although it is indeed possible to do that, there is a price...
In Spacemacs or Emacs, in general, is not possible to bind commands or anything to a modifier key alone like meta, control, super, shift, command (macOS) etc and sometimes is very useful to bind that one button you barely use to some important functionality.
In my case I use Spacemacs, there are two very important commands I use a lot:
M-m: the leader key, i.e., the key that opens the default spacemacs menu,
SPC if you use... the evil mode urgh...
M-m m: the major mode leader key, that opens the major mode menu, in evil mode the default binding is
You can't normally bind these functionalities to modifier keys, you can bind
M-[something], but not
M- alone, but there is a way around...
After some hours suffering from this problem, I've come to a solution I've found here. If you can't bind something to a modifier key, change that key so it will not be a modifier key anymore...
I've switched my
f17. It's not the point of this text, but I really recommend that anyone who codes to switch
(defun dotspacemacs/init () ;; ... dotspacemacs-emacs-leader-key "<f19>" ;; ... dotspacemacs-major-mode-emacs-leader-key "<f17>" ;; ... )
Now I can access these two menus with one key :)
One might say that in evil mode I'd have access to those menus in one key but you have to leave editing mode to do that, so it would cost you more than one key to achieve that.
The only problem with this trick is that while in Emacs or not, you've lost those keys on your keyboard, or at least if you don't add any new binds using those
These changes improved a lot my life while I'm coding, what used to take me three keys to do I do in just one, and these are two of my most used shortcuts, it is not called leader key for nothing... haha.
I hope that it can help some of you as well :)
Be safe, use masks and use Emacs