diff options
author | Ashley Duckworth | 2021-01-22 13:09:50 -0600 |
---|---|---|
committer | Ashley Duckworth | 2021-01-22 13:09:50 -0600 |
commit | 4272569dc9ad98b6e031614b6c1f8d0b490b0a52 (patch) | |
tree | 29c85acc8a0f9003c7764750dc2dcf3fe8273427 | |
parent | Add smartparens (diff) | |
download | emacs-4272569dc9ad98b6e031614b6c1f8d0b490b0a52.tar.gz emacs-4272569dc9ad98b6e031614b6c1f8d0b490b0a52.zip |
Add acdw/mode
-rw-r--r-- | config.org | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/config.org b/config.org index 409767e..8556c33 100644 --- a/config.org +++ b/config.org | |||
@@ -157,7 +157,7 @@ to switch to the other buffer if there's only one window in the frame. | |||
157 | And I'll bind it to =M-o=, since that's easier to reach than =C-x o=. | 157 | And I'll bind it to =M-o=, since that's easier to reach than =C-x o=. |
158 | 158 | ||
159 | #+begin_src emacs-lisp :noweb-ref bindings | 159 | #+begin_src emacs-lisp :noweb-ref bindings |
160 | (define-key global-map (kbd "M-o") #'other-window-or-buffer) | 160 | (define-key acdw/map (kbd "M-o") #'other-window-or-buffer) |
161 | #+end_src | 161 | #+end_src |
162 | 162 | ||
163 | ** Buffers | 163 | ** Buffers |
@@ -231,7 +231,7 @@ function to the =kill-buffer-query-functions= hook that will return | |||
231 | #+end_src | 231 | #+end_src |
232 | 232 | ||
233 | #+begin_src emacs-lisp :noweb-ref bindings | 233 | #+begin_src emacs-lisp :noweb-ref bindings |
234 | (define-key ctl-x-map "k" #'kill-a-buffer) | 234 | (define-key acdw/map (kbd "C-x k") #'kill-a-buffer) |
235 | #+end_src | 235 | #+end_src |
236 | 236 | ||
237 | ** Cursor | 237 | ** Cursor |
@@ -492,6 +492,68 @@ to /hide/ those contents. | |||
492 | read-file-name-completion-ignore-case t) | 492 | read-file-name-completion-ignore-case t) |
493 | #+end_src | 493 | #+end_src |
494 | 494 | ||
495 | * Bindings | ||
496 | |||
497 | ** Acdw Mode | ||
498 | |||
499 | I've decided to set up a custom minor mode for my keybindings, as | ||
500 | suggested in [[https://github.com/larstvei/dot-emacs#key-bindings][Lars Tvei]]'s config, so that I can override all other | ||
501 | modes with my own keybindings. Plus I can easily turn it off and back | ||
502 | on as I please. | ||
503 | |||
504 | #+begin_src emacs-lisp :noweb-ref acdw-mode | ||
505 | (defvar acdw/map (make-sparse-keymap) | ||
506 | "A keymap for my custom bindings.") | ||
507 | |||
508 | (define-minor-mode acdw/mode | ||
509 | "A mode for `acdw/map'." | ||
510 | :init-value t | ||
511 | :lighter " ⱷ" | ||
512 | :keymap acdw/map) | ||
513 | |||
514 | (define-globalized-minor-mode acdw/global-mode acdw/mode acdw/mode) | ||
515 | #+end_src | ||
516 | |||
517 | *** Turn off acdw/mode in the minibuffer | ||
518 | |||
519 | #+begin_src emacs-lisp :noweb-ref acdw-mode | ||
520 | (defun acdw/mode--disable () | ||
521 | "Turn off acdw/mode." | ||
522 | (acdw/mode -1)) | ||
523 | |||
524 | (add-hook 'minibuffer-setup-hook #'acdw/mode--disable) | ||
525 | #+end_src | ||
526 | |||
527 | *** Custom leader | ||
528 | |||
529 | Since =C-z= is generally pretty useless in Emacs (minimize the window? | ||
530 | really?), I rebind it to be a sort of personal leader key. I | ||
531 | generally use it as a leader for entering applications. | ||
532 | |||
533 | #+begin_src emacs-lisp :noweb-ref acdw-mode | ||
534 | (defvar acdw/leader | ||
535 | (let ((map (make-sparse-keymap)) | ||
536 | (c-z (global-key-binding "\C-z"))) | ||
537 | ;(global-unset-key "\C-z") | ||
538 | (define-key acdw/map "\C-z" map) | ||
539 | (define-key map "\C-z" c-z) | ||
540 | map)) | ||
541 | |||
542 | ;; Just in case I want to run hooks after defining the leader map | ||
543 | (run-hooks 'acdw/leader-defined-hook) | ||
544 | #+end_src | ||
545 | |||
546 | ** Show keybindings with =which-key= | ||
547 | |||
548 | #+begin_src emacs-lisp :noweb-ref packages | ||
549 | (straight-use-package 'which-key) | ||
550 | #+end_src | ||
551 | |||
552 | #+begin_src emacs-lisp :noweb-ref modes | ||
553 | (which-key-mode +1) | ||
554 | (blackout 'which-key-mode) | ||
555 | #+end_src | ||
556 | |||
495 | * Persistence | 557 | * Persistence |
496 | 558 | ||
497 | ** Minibuffer history | 559 | ** Minibuffer history |
@@ -872,8 +934,8 @@ It manages my whitespace for me, anyway. | |||
872 | #+end_src | 934 | #+end_src |
873 | 935 | ||
874 | #+begin_src emacs-lisp :noweb-ref bindings | 936 | #+begin_src emacs-lisp :noweb-ref bindings |
875 | (define-key global-map (kbd "C-/") #'undo-fu-only-undo) | 937 | (define-key acdw/map (kbd "C-/") #'undo-fu-only-undo) |
876 | (define-key global-map (kbd "C-?") #'undo-fu-only-redo) | 938 | (define-key acdw/map (kbd "C-?") #'undo-fu-only-redo) |
877 | #+end_src | 939 | #+end_src |
878 | 940 | ||
879 | *** Undo Fu session | 941 | *** Undo Fu session |