diff options
author | Case Duckworth | 2021-08-26 16:04:08 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-26 16:04:08 -0500 |
commit | bfa31f593c904458e697477c8a7c3cb0018aa0c9 (patch) | |
tree | dce0a2db5b61a573040dce886b327d5d9c1fdcde | |
parent | Resort minibuffer options (diff) | |
download | emacs-bfa31f593c904458e697477c8a7c3cb0018aa0c9.tar.gz emacs-bfa31f593c904458e697477c8a7c3cb0018aa0c9.zip |
Add `case-repeat-map' to change word case
I'm pretty proud of this one, actually.
-rw-r--r-- | init.el | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/init.el b/init.el index 02cd850..77856e1 100644 --- a/init.el +++ b/init.el | |||
@@ -1005,7 +1005,32 @@ like a dumbass." | |||
1005 | "C-c c" capitalize-dwim | 1005 | "C-c c" capitalize-dwim |
1006 | "C-c u" upcase-dwim | 1006 | "C-c u" upcase-dwim |
1007 | "C-c l" downcase-dwim | 1007 | "C-c l" downcase-dwim |
1008 | "C-c t" acdw/insert-iso-date)) | 1008 | "C-c t" acdw/insert-iso-date) |
1009 | |||
1010 | (defalias 'forward-word-with-case 'forward-word | ||
1011 | "Alias for `forward-word' for use in `case-repeat-map'.") | ||
1012 | (defalias 'backward-word-with-case 'backward-word | ||
1013 | "Alias for `backward-word for use in `case-repeat-map'.") | ||
1014 | |||
1015 | (defvar case-repeat-map | ||
1016 | (let ((map (make-sparse-keymap))) | ||
1017 | (define-key map "c" #'capitalize-word) | ||
1018 | (define-key map "u" #'upcase-word) | ||
1019 | (define-key map "l" #'downcase-word) | ||
1020 | ;; movement | ||
1021 | (define-key map "f" #'forward-word-with-case) | ||
1022 | (define-key map "b" #'backward-word-with-case) | ||
1023 | map) | ||
1024 | "A map to repeat word-casing commands. For use with `repeat-mode'.") | ||
1025 | (dolist (command '(capitalize-word | ||
1026 | capitalize-dwim | ||
1027 | upcase-word | ||
1028 | upcase-dwim | ||
1029 | downcase-word | ||
1030 | downcase-dwim | ||
1031 | forward-word-with-case | ||
1032 | backward-word-with-case)) | ||
1033 | (put command 'repeat-map 'case-repeat-map))) | ||
1009 | 1034 | ||
1010 | 1035 | ||
1011 | ;;; Packages | 1036 | ;;; Packages |