Skip to content

Instantly share code, notes, and snippets.

@mahmoudimus
Last active July 10, 2024 17:18
Show Gist options
  • Save mahmoudimus/1a170e26acf026232638494563c4b8f8 to your computer and use it in GitHub Desktop.
Save mahmoudimus/1a170e26acf026232638494563c4b8f8 to your computer and use it in GitHub Desktop.
Emacs Key Leader Keys

Obviously the normal ones are: Ctrl-x, Ctrl-u

Alt can be a good leader prefix. Alt-x is emacs-extended-command. Alt-m is used by spacemacs.

Visual Studio has Ctrl-k, Ctrl-e, but IMO, they are not good. Those are very "hot" keys that are used all the time

Tmux has Ctrl-b, which is almost always rebound to Ctrl-a for memory compatibility with Screen's Ctrl-a. It's also not good IMO, but Tmux is used very often that it is reasonable to include Ctrl-a as a leader key.

One I've started playing with is Ctrl-Insert - it has almost no conflicts. There are also Ctrl-Numlock and Ctrl-Scrolllock

(use-package general
:ensure t
:config
;; allow for shorter bindings -- e.g., just using things like nmap alone without general-* prefix
(general-evil-setup t)
;; To automatically prevent Key sequence starts with a non-prefix key errors without the need to
;; explicitly unbind non-prefix keys, you can add (general-auto-unbind-keys) to your configuration
;; file. This will advise define-key to unbind any bound subsequence of the KEY. Currently, this
;; will only have an effect for general.el key definers. The advice can later be removed with
;; (general-auto-unbind-keys t).
(general-auto-unbind-keys)
(general-create-definer jds/leader-def
:states '(normal visual motion emacs insert)
:keymaps 'override
:prefix "SPC"
:global-prefix "C-SPC")
(general-create-definer jds/sub-leader-def
:states '(normal visual motion emacs)
:keymaps 'override
:prefix ","
:global-prefix "C-,")
(general-create-definer jds/localleader-def
:states '(normal visual motion emacs)
:keymaps 'override
:prefix "m"
;; :global-prefix "C-m"
)
(general-create-definer jds/sub-localleader-def
:states '(normal visual motion emacs)
:keymaps 'override
:prefix "\\"
:global-prefix "C-\\"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment