1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 04:22:50 -05:00

Add which-key helper

This commit is contained in:
Jack Foltz 2019-02-10 11:53:50 -05:00
parent adb3d0ce0c
commit 680ff99579
No known key found for this signature in database
GPG Key ID: E7B502AB1576E6CD

View File

@ -98,19 +98,22 @@ keybindings following incomplete commands.
#+END_SRC
** General
[[https://github.com/noctuid/general.el][General]] is an excellent keybind manager that adds *tons* of useful macros.
Also set up a leader key and prefixes, like =\= in Vim.
#+BEGIN_SRC emacs-lisp
(use-package general)
#+END_SRC
** Leaders
Create a leader key, =SPC=, like =\= in vim.
Different button presses after the leader bring you to different options.
#+BEGIN_SRC emacs-lisp
(use-package general
:config
(general-create-definer jf-leader-def
:keymaps 'override
:states '(normal insert emacs)
:prefix "SPC"
:non-normal-prefix "M-SPC")
(defun jf-create-wk-prefix (desc)
"Helper for creating which-key prefix descriptions.
Bind to a key with general to make which-key show DESC
as the prefix's description"
`(:ignore t :wk ,desc))
(defmacro jf-create-definers (definitions)
"A wrapper for general-create-definer.
For every pair in DEFINITIONS, creates a leader
@ -125,17 +128,19 @@ Different button presses after the leader bring you to different options.
:states '(normal insert emacs)
:prefix ,(concat "SPC " key)
:non-normal-prefix ,(concat "M-SPC " key))
(jf-leader-def ,key '(:ignore t :wk ,name)))))
(jf-leader-def ,key ',(jf-create-wk-prefix name)))))
definitions)))
(jf-create-definers
(("b" . "buffers")
(("a" . "apps")
("b" . "buffers")
("f" . "files")
("g" . "git")
("h" . "help")
("m" . "major")
("o" . "org")
("p" . "projects")
("w" . "windows")))
("w" . "windows"))))
#+END_SRC
* Vim Emulation
** Evil