mirror of
https://github.com/Foltik/dotfiles
synced 2024-11-24 12:26:05 -05:00
Add which-key helper
This commit is contained in:
parent
adb3d0ce0c
commit
680ff99579
@ -98,19 +98,22 @@ keybindings following incomplete commands.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
** General
|
** General
|
||||||
[[https://github.com/noctuid/general.el][General]] is an excellent keybind manager that adds *tons* of useful macros.
|
[[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
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package general)
|
(use-package general
|
||||||
#+END_SRC
|
:config
|
||||||
** Leaders
|
|
||||||
Create a leader key, =SPC=, like =\= in vim.
|
|
||||||
Different button presses after the leader bring you to different options.
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(general-create-definer jf-leader-def
|
(general-create-definer jf-leader-def
|
||||||
:keymaps 'override
|
:keymaps 'override
|
||||||
:states '(normal insert emacs)
|
:states '(normal insert emacs)
|
||||||
:prefix "SPC"
|
:prefix "SPC"
|
||||||
:non-normal-prefix "M-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)
|
(defmacro jf-create-definers (definitions)
|
||||||
"A wrapper for general-create-definer.
|
"A wrapper for general-create-definer.
|
||||||
For every pair in DEFINITIONS, creates a leader
|
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)
|
:states '(normal insert emacs)
|
||||||
:prefix ,(concat "SPC " key)
|
:prefix ,(concat "SPC " key)
|
||||||
:non-normal-prefix ,(concat "M-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)))
|
definitions)))
|
||||||
|
|
||||||
(jf-create-definers
|
(jf-create-definers
|
||||||
(("b" . "buffers")
|
(("a" . "apps")
|
||||||
|
("b" . "buffers")
|
||||||
("f" . "files")
|
("f" . "files")
|
||||||
("g" . "git")
|
("g" . "git")
|
||||||
("h" . "help")
|
("h" . "help")
|
||||||
|
("m" . "major")
|
||||||
("o" . "org")
|
("o" . "org")
|
||||||
("p" . "projects")
|
("p" . "projects")
|
||||||
("w" . "windows")))
|
("w" . "windows"))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Vim Emulation
|
* Vim Emulation
|
||||||
** Evil
|
** Evil
|
||||||
|
Loading…
Reference in New Issue
Block a user