Inspired by this post, I tried to set up a second leader key for my Xah-Fly-Keys for major mode commands (as suggested in the post). But I couldn't find how I can set up the second leader key for Xah-Fly-Keys. I also ask this question in Xah-Fly-Keys Reddit forum but didn't get any answer. Does anyone know how?

In case you wonder why I'm trying to that: The purpose is using a single key binding for similar actions in different major-modes. For example, running a unit of code (e.g. a source block in org-mode, a cell in matlab-mode and etc) with e.g. + RET (note that is the "second leader key" suggested by the post I mentioned). I propose a solution in Reddit forum, but with using the control key (rather a new leader key).

1 Answer 1


First one needs introduce <deletechar> to command mode of xah-fly-keys (XFK):

(defun ss-xfk-addon-command()
  "Modify keys for xah fly key command mode keys
To be added to `xah-fly-insert-mode-activate-hook'"
  (define-key xah-fly-key-map (kbd "<deletechar>") 'ss-xfk-delchar-keymap)
  ;; more here

Then add the needed keybindings; For example this is a piece from my config:

 (define-prefix-command 'ss-xfk-delchar-keymap)
   ("a" . eshell-command)

   ("c" . increment-number-at-point) ; i
   ("t" . decrement-number-at-point) ; k

   ("." . org-edit-special) ; e

   ("RET" . ss-run-code-unit)
   ("n" . read-only-mode) ; l

   ("v" . flyspell-auto-correct-word) ; .
   ("w" . flyspell-goto-next-error) ; ,

   ("e" . goto-line) ; d


and then let then, let XFK add them to the command mode:

(add-hook 'xah-fly-command-mode-activate-hook 'ss-xfk-addon-command)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.