diff options
author | Case Duckworth | 2021-09-06 23:48:32 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-06 23:48:32 -0500 |
commit | f4ec66ca046b3ffff791e74874eef3f235ae5634 (patch) | |
tree | d18923be61c4c9a8beb408b4af339826f38d9166 | |
parent | Move trashed to its own setup form (diff) | |
download | emacs-f4ec66ca046b3ffff791e74874eef3f235ae5634.tar.gz emacs-f4ec66ca046b3ffff791e74874eef3f235ae5634.zip |
Repeat-key ... stuff
... A frustrating, confusing bug
-rw-r--r-- | init.el | 112 |
1 files changed, 58 insertions, 54 deletions
diff --git a/init.el b/init.el index ba9ca9e..334526e 100644 --- a/init.el +++ b/init.el | |||
@@ -62,7 +62,10 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
62 | (car feature) | 62 | (car feature) |
63 | feature)) | 63 | feature)) |
64 | (car name)) | 64 | (car name)) |
65 | name)))))))) | 65 | name))))))) |
66 | |||
67 | (:global "C-x o" #'acdw/other-window-or-switch-buffer | ||
68 | "C-x O" #'acdw/other-window-or-switch-buffer-backward)) | ||
66 | 69 | ||
67 | (setup (:straight-if affe | 70 | (setup (:straight-if affe |
68 | (and (or (executable-find "fd") | 71 | (and (or (executable-find "fd") |
@@ -382,27 +385,11 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
382 | "TAB" #'vertico-exit)))) | 385 | "TAB" #'vertico-exit)))) |
383 | 386 | ||
384 | (setup (:straight crux) | 387 | (setup (:straight crux) |
385 | (:global "C-x o" #'acdw/other-window-or-switch-buffer | 388 | (:global "C-o" #'crux-smart-open-line |
386 | "C-o" #'crux-smart-open-line | ||
387 | "M-o" #'crux-smart-open-line-above | 389 | "M-o" #'crux-smart-open-line-above |
388 | "C-M-\\" #'crux-cleanup-buffer-or-region | 390 | "C-M-\\" #'crux-cleanup-buffer-or-region |
389 | "C-x 4 t" #'crux-transpose-windows) | 391 | "C-x 4 t" #'crux-transpose-windows) |
390 | 392 | ||
391 | (when (fboundp 'repeat-mode) | ||
392 | (defvar other-window-repeat-map (make-sparse-keymap) | ||
393 | "A map for repeating `other-window' keys.") | ||
394 | |||
395 | (define-key other-window-repeat-map "o" | ||
396 | #'acdw/other-window-or-switch-buffer) | ||
397 | (define-key other-window-repeat-map "O" | ||
398 | (defun acdw/other-window-or-switch-buffer-backward () | ||
399 | (interactive) | ||
400 | (setq repeat-map 'other-window-repeat-map) | ||
401 | (acdw/other-window-or-switch-buffer -1))) | ||
402 | |||
403 | (put 'acdw/other-window-or-switch-buffer | ||
404 | 'repeat-map 'other-window-repeat-map)) | ||
405 | |||
406 | (crux-reopen-as-root-mode +1)) | 393 | (crux-reopen-as-root-mode +1)) |
407 | 394 | ||
408 | (setup cursor | 395 | (setup cursor |
@@ -453,6 +440,49 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
453 | (setup debugger | 440 | (setup debugger |
454 | (:hook visual-line-mode)) | 441 | (:hook visual-line-mode)) |
455 | 442 | ||
443 | ;; (setup (:straight (define-repeat-map | ||
444 | ;; :host nil | ||
445 | ;; :repo "https://tildegit.org/acdw/define-repeat-map.el")) | ||
446 | |||
447 | ;; (defun acdw/other-window-or-switch-buffer-backward () | ||
448 | ;; (interactive) | ||
449 | ;; (setq repeat-map 'other-window-repeat-map) | ||
450 | ;; (acdw/other-window-or-switch-buffer -1)) | ||
451 | |||
452 | ;; (define-repeat-map other-window | ||
453 | ;; ("o" acdw/other-window-or-switch-buffer | ||
454 | ;; "O" acdw/other-window-or-switch-buffer-backward)) | ||
455 | |||
456 | ;; (define-repeat-map case | ||
457 | ;; ("c" capitalize-word | ||
458 | ;; "u" upcase-dwim | ||
459 | ;; "l" downcase-dwim) | ||
460 | ;; (:continue "f" forward-word | ||
461 | ;; "b" backward-word) | ||
462 | ;; (:enter capitalize-dwim | ||
463 | ;; upcase-dwim | ||
464 | ;; downcase-dwim)) | ||
465 | |||
466 | ;; (define-repeat-map page-navigation | ||
467 | ;; ("]" forward-page | ||
468 | ;; "[" backward-page)) | ||
469 | |||
470 | ;; (define-repeat-map windmove | ||
471 | ;; (;; moving | ||
472 | ;; [left] windmove-left | ||
473 | ;; [right] windmove-right | ||
474 | ;; [up] windmove-up | ||
475 | ;; [down] windmove-down | ||
476 | ;; ;; swapping | ||
477 | ;; [S-left] windmove-swap-states-left | ||
478 | ;; [S-right] windmove-swap-states-right | ||
479 | ;; [S-up] windmove-swap-states-up | ||
480 | ;; [S-down] windmove-swap-states-down)) | ||
481 | |||
482 | ;; (define-repeat-map winner-mode | ||
483 | ;; ("/" winner-undo | ||
484 | ;; "?" winner-redo))) | ||
485 | |||
456 | (setup dired | 486 | (setup dired |
457 | (:also-load dired-x) | 487 | (:also-load dired-x) |
458 | (:straight dired-subtree | 488 | (:straight dired-subtree |
@@ -673,7 +703,6 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
673 | native-comp-async-report-warnings-errors nil | 703 | native-comp-async-report-warnings-errors nil |
674 | password-cache t | 704 | password-cache t |
675 | password-cache-expiry 3600 ; 5 minutes | 705 | password-cache-expiry 3600 ; 5 minutes |
676 | read-extended-command-predicate ; emacs 28 | ||
677 | set-mark-command-repeat-pop t) | 706 | set-mark-command-repeat-pop t) |
678 | 707 | ||
679 | (when (fboundp 'command-completion-default-include-p) | 708 | (when (fboundp 'command-completion-default-include-p) |
@@ -687,52 +716,27 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
687 | (defvar lookup-map (make-sparse-keymap) | 716 | (defvar lookup-map (make-sparse-keymap) |
688 | "A keymap for looking up things.") | 717 | "A keymap for looking up things.") |
689 | (global-set-key (kbd "C-c l") lookup-map) | 718 | (global-set-key (kbd "C-c l") lookup-map) |
690 | |||
691 | (:global "M-=" #'count-words | ||
692 | "C-w" #'kill-region-or-backward-word | ||
693 | "C-c c c" #'capitalize-dwim | ||
694 | "C-c c t" #'titlecase-dwim | ||
695 | "C-c c u" #'upcase-dwim | ||
696 | "C-c c l" #'downcase-dwim | ||
697 | "C-c d" #'acdw/insert-iso-date | ||
698 | "M-`" nil) | ||
699 | 719 | ||
700 | ;; toggle bindings | ||
701 | (defvar toggle-map (make-sparse-keymap) | 720 | (defvar toggle-map (make-sparse-keymap) |
702 | "A keymap for toggling!") | 721 | "A keymap for toggling!") |
703 | (global-set-key (kbd "C-c t") toggle-map) | 722 | (global-set-key (kbd "C-c t") toggle-map) |
704 | 723 | ||
724 | (:global "M-=" #'count-words | ||
725 | "C-w" #'kill-region-or-backward-word | ||
726 | "C-c d" #'acdw/insert-iso-date | ||
727 | "M-`" nil) | ||
728 | |||
705 | (:with-map toggle-map | 729 | (:with-map toggle-map |
706 | (:bind "c" #'column-number-mode | 730 | (:bind "c" #'column-number-mode |
707 | "l" #'display-line-numbers-mode | 731 | "l" #'display-line-numbers-mode |
708 | "d" #'toggle-debug-on-error)) | 732 | "d" #'toggle-debug-on-error)) |
709 | 733 | ||
710 | (defalias 'forward-word-with-case 'forward-word | 734 | (:with-map case-map |
711 | "Alias for `forward-word' for use in `case-repeat-map'.") | 735 | (:bind "c" #'capitalize-dwim |
712 | (defalias 'backward-word-with-case 'backward-word | 736 | "t" #'titlecase-dwim |
713 | "Alias for `backward-word for use in `case-repeat-map'.") | 737 | "u" #'upcase-dwim |
714 | 738 | "l" #'downcase-dwim)) | |
715 | (defvar case-repeat-map | ||
716 | (let ((map (make-sparse-keymap))) | ||
717 | (define-key map "c" #'capitalize-word) | ||
718 | (define-key map "u" #'upcase-word) | ||
719 | (define-key map "l" #'downcase-word) | ||
720 | ;; movement | ||
721 | (define-key map "f" #'forward-word-with-case) | ||
722 | (define-key map "b" #'backward-word-with-case) | ||
723 | map) | ||
724 | "A map to repeat word-casing commands. For use with `repeat-mode'.") | ||
725 | 739 | ||
726 | (dolist (command '(capitalize-word | ||
727 | capitalize-dwim | ||
728 | upcase-word | ||
729 | upcase-dwim | ||
730 | downcase-word | ||
731 | downcase-dwim | ||
732 | forward-word-with-case | ||
733 | backward-word-with-case)) | ||
734 | (put command 'repeat-map 'case-repeat-map)) | ||
735 | |||
736 | (add-hook 'after-make-frame-functions | 740 | (add-hook 'after-make-frame-functions |
737 | (defun after-make-frame@maximize (frame) | 741 | (defun after-make-frame@maximize (frame) |
738 | (unless (bound-and-true-p edit-server-frame-p) | 742 | (unless (bound-and-true-p edit-server-frame-p) |