Emacs: Xah Fly Keys, Setup Keys for Major Mode
Setup Major Mode Custom Keys
Normally, Major Mode keys start with Ctrl+Ctrl.
Here's the best way to create leader key set for any Major Mode , so you don't have to press Ctrl+c.
- Get a list of the major mode's commands you want. You do this by first activate the major mode (or open a file that invoke the major mode), then, Alt+x
describe-mode
, to list all commands of the mode. - Then, decide on a leader key to call them. e.g. if leader key is Tab , you might have Tab a and Tab b and Tab c.
- Find out what's the keymap name in the major mode. (look at its source code), then do as follows.
Example: Setup Keys for Go language mode
Here's a example with go-mode.el.
;; example of adding a leader key map to golang mode (when (fboundp 'go-mode) (defun xah-config-go-mode () "config go-mode. Version 2021-01-15" (interactive) (progn ;; create a keymap (define-prefix-command 'xah-golang-leader-map) ;; add keys to it (define-key xah-golang-leader-map (kbd "c") 'xah-gofmt) (define-key xah-golang-leader-map (kbd "j") 'godef-jump) ;; add more of the major mode key/command here ) ;; modify the major mode's key map, so that a key becomes your leader key (define-key go-mode-map (kbd "TAB") xah-golang-leader-map) ;; ) (add-hook 'go-mode-hook 'xah-config-go-mode))
Setup Org-Mode Keys for Xah Fly Keys
emacs, Xah Fly Keys, customization
- Emacs: Xah Fly Keys Customization
- Emacs: Xah Fly Keys, Add Keys to Switch Mode
- Emacs: Xah Fly Keys, Add a Global Leader Key
- Emacs: Xah Fly Keys, Modify Leader Key Sequence
- Emacs: Xah Fly Keys, Setup Keys for Major Mode
- Emacs: Xah Fly Keys, Key for Org-Mode
- Emacs: Xah Fly Keys, Create a New Layout
- Emacs: Xah Fly Keys Escape Key
- Emacs: Xah Fly Keys Mode Status Indicator
- How to Make the CapsLock Key do Home Key
- Emacs: Xah Fly Keys, Emacs Daemon
- Emacs: Xah Fly Keys, Russian Layout