Doom-emacs: changing leader key to F13

Created on 21 Aug 2018  路  12Comments  路  Source: hlissner/doom-emacs

In Spacemacs, I changed my global leader key to F13, which is mapped to my caps lock key via xmodmap, so that I could do things like describe-key (SPC h k) in Doom's default config. I already set doom-leader-key, but I have no idea how to tell Doom that this can be used in insert-state too. Any help would be appreciated, and thanks for a great Emacs configuration.

Edit: I am on the tip of the develop branch.

discussion keybinds resolved

Most helpful comment

WIth general integrated into Doom now, the original issue should be resolved. Let me know if that isn't the case and I will reopen the issue.

To have F13 be your leader key in all states, insert states included, this should work:

;; in ~/.doom.d/init.el
(setq doom-leader-key "<F13>"
      doom-leader-alt-key "<F13>")

All 12 comments

I think you need to bind F13 in global map to a function that mimic the leader key-press events. Not quite sure about the detail yet, but I think google might tell you the answer.

Thanks. I actually did search google before asking for help here. Still searching unsuccessfully for the correct recipe to allow me to use a non-printing leader key such as <f13> in all evil states.

Unfortunately, this isn't easy. The way Doom binds leader keys is rigid (they're only bound in normal and visual modes). I'm working on a revamp of Doom's keybinds and underlying system which should make this trivial to do, but for the time being your best bet is to map F13 to C-o SPC. It's a hack, but it may just work:

(map! :i "<f13>" (位! (push 32 unread-command-events)
                     (push ?\C-o unread-command-events)))

@hlissner Thanks for the suggestion. That does work, however it also switches the state to normal state, first, so things like describe-key are useless. I guess I'll retry Doom at a later date when your refactor is complete if I can't work around this issue.

Totally understandable. The refactor will happen around early September. I'll leave this open until it is done so you'll get a notification once it's done.

Thank you @hlissner. I am new here, and while this does change what I'm used to, I'm willing to stick around anyway. I'm a long time vim, vanilla Emacs (with my own extensive config atop), and Spacemacs user, and after using Doom for 2 days I can say it's snappy, has good defaults, consistent/declarative macros, looks great, and my favorite config for sure. I'll be sticking around!

@hlissner Can I use same principle to remap localleader key?
Currently this is SPC m but I want to remap this to , just like a Spacemacs. I want this since I'm too laze to type more than one key stroke for leader key. ;)
If it needs a lot of work then I wish a feature that user can add alias for leader(or local leader)key, it would be really nice.

@sleepyeye Sorry for the late response. You can change the localleader by setting doom-localleader-key in ~/.doom.d/init.el.

(setq doom-localleader-key ",")

WIth general integrated into Doom now, the original issue should be resolved. Let me know if that isn't the case and I will reopen the issue.

To have F13 be your leader key in all states, insert states included, this should work:

;; in ~/.doom.d/init.el
(setq doom-leader-key "<F13>"
      doom-leader-alt-key "<F13>")

@hlissner Can I map localleader key both with , and SPC m?

@forrestchang Did you ever get an answer on whether localleader can be mapped to both , and SPC m?

@jrmiller82 Not yet.

Was this page helpful?
0 / 5 - 0 ratings