Refactor my key bindings into submaps

This commit is contained in:
Gergely Polonkai 2023-10-20 12:15:53 +02:00
parent 76d99e522a
commit 93851abbe2
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -3036,62 +3036,73 @@ Because thats still my favourite language.
(if prefix (if prefix
'isearch-backward-regexp 'isearch-backward-regexp
'isearch-forward-regexp))) 'isearch-forward-regexp)))
#+end_src
#+begin_src emacs-lisp (defvar gpolonkai/transpose-map (make-sparse-keymap)
"Map for transpose commands.")
(define-prefix-command 'gpolonkai/transpose-map)
(defvar gpolonkai/org-clock-map (make-sparse-keymap)
"Map for Org clocking commands.")
(define-prefix-command 'gpolonkai/org-clock-map)
(bind-keys (bind-keys
:map global-map :map global-map
("<C-return>" . wted/open-line-below) ("<C-return>" . wted/open-line-below)
("<C-S-return>" . wted/open-line-above) ("<C-S-return>" . wted/open-line-above)
("M-t" . nil) ;; Remove the old keybinding ("C-~" . gpolonkai/toggle-char-case)
("M-t c" . transpose-chars)
("M-t w" . transpose-words)
("M-t l" . transpose-lines)
("M-t e" . transpose-sexps)
("M-t s" . transpose-sentences)
("M-t p" . transpose-paragraphs)
("M-t W" . gpolonkai/transpose-windows)
("C-a" . gpolonkai/move-to-beginning-of-line) ("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line) ("C-e" . gpolonkai/move-to-end-of-line)
("M-q" . sachachua/fill-or-unfill-paragraph)
("C-c r" . gpolonkai/round-number-at-point-to-decimals)
("C-s" . consult-line)
("C-r" . gpolonkai/isearch-regexp)
("C-M-s" . isearch-forward)
("C-M-r" . isearch-backward)
("C-~" . gpolonkai/toggle-char-case)
("C-z" . nil)
("M-g SPC" . gpolonkai/goto-next-char)
("M-F" . gpolonkai/beginning-of-next-word) ("M-F" . gpolonkai/beginning-of-next-word)
("C-h C-l" . find-library) ("C-h C-l" . find-library)
("C-h C-f" . find-function) ("C-h C-f" . find-function)
("C-h C-k" . find-function-on-key) ("C-h C-k" . find-function-on-key)
("C-h C-v" . find-variable) ("C-h C-v" . find-variable)
("M-q" . sachachua/fill-or-unfill-paragraph)
("C-r" . gpolonkai/isearch-regexp)
("C-M-r" . isearch-backward)
("C-s" . consult-line)
("C-M-s" . isearch-forward)
("M-t" . gpolonkai/transpose-map)
("C-z" . nil)
:map mode-specific-map
("r" . gpolonkai/round-number-at-point-to-decimals)
:map gpolonkai/transpose-map
("c" . transpose-chars)
("e" . transpose-sexps)
("l" . transpose-lines)
("p" . transpose-paragraphs)
("s" . transpose-sentences)
("w" . transpose-words)
("W" . gpolonkai/transpose-windows)
:map gpolonkai/org-clock-map
("g" . org-clock-goto)
("i" . org-clock-in)
("I" . org-clock-in-last)
("o" . org-clock-out)
:map gpolonkai/pers-map
("c" . gpolonkai/org-clock-map)
("C-c" . calc)
("M-C" . clean-buffer-list)
("h" . hidden-mode-line-mode)
("i" . string-inflection-all-cycle)
("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/")
("M-o" . mbork/insert-current-file-name-at-point)
("u" . browse-url-at-point)
:map ctl-x-map :map ctl-x-map
("C-y" . duplicate-line)
("_" . maximize-window) ("_" . maximize-window)
("C-r" . wted/rename-current-buffer-file)
("C-d" . wted/delete-current-buffer-file)
("|" . gpolonkai/toggle-window-split) ("|" . gpolonkai/toggle-window-split)
("k" . kill-this-buffer)
("C-b" . bury-buffer)
("/" . repeat) ("/" . repeat)
("C-b" . bury-buffer)
("C-d" . wted/delete-current-buffer-file)
("k" . kill-this-buffer)
("C-r" . wted/rename-current-buffer-file)
("C-y" . duplicate-line)
:map isearch-mode-map :map isearch-mode-map
("<C-return>" . ep/isearch-exit-other-end) ("<C-return>" . ep/isearch-exit-other-end)
("<S-return>" . e-se/isearch-exit-mark-match) ("<S-return>" . e-se/isearch-exit-mark-match)
:map gpolonkai/pers-map :map goto-map
("h" . hidden-mode-line-mode) ("SPC" . gpolonkai/goto-next-char))
("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/")
("u" . browse-url-at-point)
("M-C" . clean-buffer-list)
("C-c" . calc)
("c i" . org-clock-in)
("c I" . org-clock-in-last)
("c o" . org-clock-out)
("c g" . org-clock-goto)
("M-o" . mbork/insert-current-file-name-at-point)
("i" . string-inflection-all-cycle))
#+end_src #+end_src
* Custom commands and functions * Custom commands and functions