commit dd7e6f28e8227cd926de6f1e4d7a0f797c8f72d8
parent eaa9f011134685702ddb0684f48c096de10367f5
Author: dwrz <dwrz@dwrz.net>
Date: Mon, 5 Feb 2024 02:33:24 +0000
Update Emacs init
Diffstat:
M | emacs/init.el | | | 90 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- |
1 file changed, 82 insertions(+), 8 deletions(-)
diff --git a/emacs/init.el b/emacs/init.el
@@ -818,7 +818,18 @@
:ensure t)
;; Keymaps
+(defvar-keymap dwrz-buffer-map
+ :doc "Prefix keymap for buffers."
+ :name "Buffer"
+ "b" #'consult-buffer
+ "i" #'ibuffer
+ "n" #'next-buffer
+ "p" #'previous-buffer
+ "r" #'revert-buffer)
+
(defvar-keymap dwrz-cape-map
+ :doc "Prefix keymap for cape."
+ :name "Cape"
"&" #'cape-sgml
":" #'cape-emoji
"a" #'cape-abbrev
@@ -832,6 +843,20 @@
"s" #'cape-elisp-symbol
"w" #'cape-dict)
+(defvar-keymap dwrz-file-map
+ :doc "Prefix keymaps for files."
+ :name "File"
+ "f" #'find-file
+ "F" #'find-file-other-window
+ "d" #'dired)
+
+(defvar-keymap dwrz-help-map
+ :doc "Prefix keymap for help."
+ :name "Help"
+ "k" (cons "key" #'describe-key)
+ "f" (cons "function" #'describe-function)
+ "v" (cons "variable" #'describe-variable))
+
(defvar-keymap dwrz-highlight-map
:doc "Prefix keymap for highlight."
:name "Highlight"
@@ -841,22 +866,51 @@
"s" #'highlight-symbol-at-point
"u" #'unhighlight-regexp)
+(defvar-keymap dwrz-movement-map
+ :doc "Prefix keymap for movement."
+ :name "Move"
+ "a" #'avy-goto-char
+ "l" #'avy-goto-line
+ "<up>" #'windmove-up
+ "<down>" #'windmove-down
+ "<left>" #'windmove-left
+ "<right>" #'windmove-right)
+
(defvar-keymap dwrz-org-map
+ :doc "Prefix keymap for org-mode."
+ :name "Org"
"a" #'(lambda () (interactive) (dwrz-switch-org-ctx "all"))
"c" #'(lambda () (interactive) (dwrz-switch-org-ctx "chimerical"))
"d" #'(lambda () (interactive) (dwrz-switch-org-ctx "dwrz"))
- "e" #'(lambda () (interactive) (dwrz-switch-org-ctx "eti")))
+ "e" #'(lambda () (interactive) (dwrz-switch-org-ctx "eti"))
+ "l" #'org-store-link
+ "L" #'org-insert-link
+ "p" #'dwrz-org-capture-at-point)
+
+(defvar-keymap dwrz-password-map
+ :doc "Prefix keymap for password-store."
+ :name "Password"
+ "c" (cons "copy" #'password-store-copy)
+ "e" (cons "edit" #'password-store-edit)
+ "g" (cons "generate" #'password-store-generate)
+ "n" (cons "rename" #'password-store-rename)
+ "r" (cons "remove" #'password-store-remove))
(defvar-keymap dwrz-point-map
:doc "Prefix keymap for point."
:name "Point"
"d" (cons "date" #'dwrz-insert-date)
- "e" #'hippie-expand
+ "e" #'emoji-search
+ "h" #'hippie-expand
"k" #'kill-word
+ "l" #'emoji-list
+ "q" #'quoted-insert
"s" #'ispell-word
"t" (cons "timestamp" #'dwrz-insert-timestamp))
(defvar-keymap dwrz-region-map
+ :doc "Prefix keymap for region."
+ :name "Region"
"U" #'prot-simple-unfill-region-or-paragraph
"c" #'rot13-region
"d" #'downcase-region
@@ -867,6 +921,8 @@
"u" #'upcase-region)
(defvar-keymap dwrz-search-map
+ :doc "Prefix keymap for search."
+ :name "Search"
"a" #'(lambda () (interactive) (consult-notmuch-address t nil))
"c" #'consult-mark
"f" #'consult-find
@@ -881,11 +937,27 @@
"v" #'consult-git-grep)
(defvar-keymap dwrz-terminal-map
+ :doc "Prefix keymap for terminal."
+ :name "Terminal"
"s" #'dwrz-shell-in-current-directory)
+(defvar-keymap dwrz-transpose-map
+ :doc "Prefix keymap for transposition."
+ :name "Transpose"
+ "c" #'transpose-chars
+ "l" #'transpose-lines
+ "p" #'transpose-paragraphs
+ "s" #'transpose-sentences
+ "w" #'transpose-words
+ "x" #'transpose-sexps)
+
(defvar-keymap dwrz-windows-map
+ :doc "Prefix keymap for windows."
+ :name "Window"
"+" #'text-scale-increase
"-" #'text-scale-decrease
+ "0" #'delete-window
+ "1" #'delete-other-windows
"9" #'dwrz-split-window-two-thirds
"=" (cons "reset" #'(lambda () (interactive) (text-scale-increase 0)))
"b" #'balance-windows
@@ -897,22 +969,24 @@
(defvar-keymap dwrz-prefix-map
:doc "Prefix keymap with multiple subkeymaps."
:name "dwrz prefix"
+ "?" (cons "help" dwrz-help-map)
"#" #'display-line-numbers-mode
"H" #'hippie-expand
+ "P" (cons "password" dwrz-password-map)
+ "T" (cons "transpose" dwrz-transpose-map)
+ "b" (cons "buffer" dwrz-buffer-map)
"c" (cons "cape" dwrz-cape-map)
"e" (cons "exec" #'execute-extended-command)
+ "f" (cons "file" dwrz-file-map)
"h" (cons "highlight" dwrz-highlight-map)
- "j" (cons "jump" #'consult-register)
+ "j" (cons "jump" #'jump-to-register)
+ "m" (cons "move" dwrz-movement-map)
"o" (cons "org" dwrz-org-map)
"p" (cons "point" dwrz-point-map)
"r" (cons "region" dwrz-region-map)
"s" (cons "search" dwrz-search-map)
- "t" (cons "exec" dwrz-terminal-map)
+ "t" (cons "terminal" dwrz-terminal-map)
"w" (cons "window" dwrz-windows-map))
;; KEYBINDINGS
(global-set-key (kbd "C-z") dwrz-prefix-map)
-(global-set-key (kbd "C-c b") 'ibuffer)
-(global-set-key (kbd "C-c c") 'dwrz-org-capture-at-point)
-(global-set-key (kbd "C-c l") 'org-store-link)
-(global-set-key (kbd "C-x C-b") 'ibuffer)