summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el111
-rw-r--r--lisp/acdw.el13
2 files changed, 108 insertions, 16 deletions
diff --git a/init.el b/init.el index 693f046..4f71122 100644 --- a/init.el +++ b/init.el
@@ -376,12 +376,13 @@ Most customizations must go in this function since `eshell' loads
376like a dumbass." 376like a dumbass."
377 ;; Define keys 377 ;; Define keys
378 (dolist (spec '(("C-d" . eshell-quit-or-delete-char))) 378 (dolist (spec '(("C-d" . eshell-quit-or-delete-char)))
379 (define-key eshell-mode-map (kbd (car spec)) (function (cdr spec)))) 379 (define-key eshell-mode-map (kbd (car spec)) (cdr spec)))
380 ;; Fix modeline 380 ;; Fix modeline
381 (when (boundp 'simple-modeline--mode-line) 381 (when (boundp 'simple-modeline--mode-line)
382 (setq mode-line-format '(:eval simple-modeline--mode-line))) 382 (setq mode-line-format '(:eval simple-modeline--mode-line)))
383 ;; Set outline-regexp for consult-outline 383 ;; Make navigating amongst prompts easier
384 (setq outline-regexp eshell-prompt-regexp)) 384 (setq-local outline-regexp eshell-prompt-regexp
385 page-delimiter eshell-prompt-regexp))
385 386
386 (defun eshell-buffer-name () 387 (defun eshell-buffer-name ()
387 (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t)) 388 (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t))
@@ -524,6 +525,7 @@ like a dumbass."
524 (add-hook 'prog-mode-hook #'goto-address-prog-mode)) 525 (add-hook 'prog-mode-hook #'goto-address-prog-mode))
525 526
526(setup ibuffer 527(setup ibuffer
528 (:also-load ibuf-ext)
527 (:option ibuffer-saved-filter-groups 529 (:option ibuffer-saved-filter-groups
528 '(("default" 530 '(("default"
529 ("dired" (mode . dired-mode)) 531 ("dired" (mode . dired-mode))
@@ -560,11 +562,10 @@ like a dumbass."
560 (interactive "P") 562 (interactive "P")
561 (if arg (ibuffer) (electric-buffer-list nil)))) 563 (if arg (ibuffer) (electric-buffer-list nil))))
562 564
563 (add-hook 'ibuffer-mode 565 (add-hook 'ibuffer-mode-hook
564 (defun ibuffer@filter-to-default () 566 (defun ibuffer@filter-to-default ()
565 (ibuffer-switch-to-saved-filter-groups "default"))) 567 (ibuffer-switch-to-saved-filter-groups "default")))
566 568
567 (:also-load ibuf-ext)
568 (:option ibuffer-show-empty-filter-groups nil 569 (:option ibuffer-show-empty-filter-groups nil
569 ibuffer-expert t)) 570 ibuffer-expert t))
570 571
@@ -692,7 +693,12 @@ like a dumbass."
692 (recentf-mode +1)) 693 (recentf-mode +1))
693 694
694(setup repeat 695(setup repeat
696 ;; new for Emacs 28!
695 (:only-if (fboundp #'repeat-mode)) 697 (:only-if (fboundp #'repeat-mode))
698
699 (:option repeat-exit-key "g"
700 repeat-exit-timeout 5)
701
696 (repeat-mode +1)) 702 (repeat-mode +1))
697 703
698(setup (:require savehist) 704(setup (:require savehist)
@@ -837,9 +843,69 @@ like a dumbass."
837 (acdw/system :home))) 843 (acdw/system :home)))
838 recenter-positions '(top middle bottom)) 844 recenter-positions '(top middle bottom))
839 845
840 (tooltip-mode -1) 846 (tooltip-mode -1))
847
848(setup winner
849 ;; see https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00888.html
850 (:global "C-x 4 C-/" winner-undo
851 "C-x 4 /" winner-undo
852 "C-x 4 C-?" winner-redo
853 "C-x 4 ?" winner-redo)
854
855 ;; add `winner-undo' and `winner-redo' to `repeat-mode'
856 (when (fboundp 'repeat-mode)
857 (defvar winner-mode-repeat-map
858 (let ((map (make-sparse-keymap)))
859 (define-key map "/" #'winner-undo)
860 (define-key map "?" #'winner-redo)
861 map)
862 "Keymap to repeat `winner-mode' sequences. Used in `repeat-mode'.")
863
864 (put 'winner-undo 'repeat-map 'winner-mode-repeat-map)
865 (put 'winner-redo 'repeat-map 'winner-mode-repeat-map))
866
841 (winner-mode +1)) 867 (winner-mode +1))
842 868
869(setup windmove
870 (:option windmove-wrap-around t)
871 (:global
872 ;; moving
873 "C-x 4 <left>" windmove-left
874 "C-x 4 <right>" windmove-right
875 "C-x 4 <up>" windmove-up
876 "C-x 4 <down>" windmove-down
877 ;; swapping
878 "C-x 4 S-<left>" windmove-swap-states-left
879 "C-x 4 S-<right>" windmove-swap-states-right
880 "C-x 4 S-<up>" windmove-swap-states-up
881 "C-x 4 S-<down>" windmove-swap-states-down)
882
883 (when (fboundp 'repeat-mode)
884 (defvar windmove-repeat-map
885 (let ((map (make-sparse-keymap)))
886 ;; moving
887 (define-key map [left] #'windmove-left)
888 (define-key map [right] #'windmove-right)
889 (define-key map [up] #'windmove-up)
890 (define-key map [down] #'windmove-down)
891 ;; swapping
892 (define-key map [S-left] #'windmove-swap-states-left)
893 (define-key map [S-right] #'windmove-swap-states-right)
894 (define-key map [S-up] #'windmove-swap-states-up)
895 (define-key map [S-down] #'windmove-swap-states-down)
896 map)
897 "Keymap to repeat various `windmove' sequences. Used in `repeat-mode'.")
898
899 (dolist (sym '(windmove-left
900 windmove-right
901 windmove-up
902 windmove-down
903 windmove-swap-states-left
904 windmove-swap-states-right
905 windmove-swap-states-up
906 windmove-swap-states-down))
907 (put sym 'repeat-map 'windmove-repeat-map))))
908
843(setup w32 909(setup w32
844 (:option w32-allow-system-shell t 910 (:option w32-allow-system-shell t
845 w32-pass-lwindow-to-system nil 911 w32-pass-lwindow-to-system nil
@@ -1047,13 +1113,25 @@ like a dumbass."
1047 (funcall #'vertico-exit))))) 1113 (funcall #'vertico-exit)))))
1048 1114
1049(setup (:straight crux) 1115(setup (:straight crux)
1050 1116
1051 (:global "M-`" crux-other-window-or-switch-buffer 1117 (:global "C-x o" acdw/other-window-or-switch-buffer
1052 "C-o" crux-smart-open-line 1118 "C-o" crux-smart-open-line
1053 "M-o" crux-smart-open-line-above 1119 "M-o" crux-smart-open-line-above
1054 "C-M-\\" crux-cleanup-buffer-or-region 1120 "C-M-\\" crux-cleanup-buffer-or-region
1055 "C-x 4 t" crux-transpose-windows) 1121 "C-x 4 t" crux-transpose-windows)
1056 1122
1123 (when (fboundp 'repeat-mode)
1124 (define-key other-window-repeat-map "o"
1125 #'acdw/other-window-or-switch-buffer)
1126 (define-key other-window-repeat-map "O"
1127 (defun acdw/other-window-or-switch-buffer-backward ()
1128 (interactive)
1129 (setq repeat-map 'other-window-repeat-map)
1130 (acdw/other-window-or-switch-buffer -1)))
1131
1132 (put 'acdw/other-window-or-switch-buffer
1133 'repeat-map 'other-window-repeat-map))
1134
1057 (crux-reopen-as-root-mode +1)) 1135 (crux-reopen-as-root-mode +1))
1058 1136
1059;; requires extension: 1137;; requires extension:
@@ -1218,14 +1296,15 @@ successive invocations."
1218 1296
1219(setup (:straight helpful) 1297(setup (:straight helpful)
1220 (:option helpful-max-buffers 5 1298 (:option helpful-max-buffers 5
1221 ;;helpful-switch-buffer-function #'pop-to-buffer 1299 helpful-switch-buffer-function #'pop-to-buffer
1222 helpful-switch-buffer-function 1300 ;; helpful-switch-buffer-function
1223 (lambda (buf) 1301 ;; (lambda (buf)
1224 (pop-to-buffer buf 1302 ;; (pop-to-buffer buf
1225 '((display-buffer-reuse-mode-window 1303 ;; '((display-buffer-reuse-mode-window
1226 display-buffer-pop-up-window) 1304 ;; display-buffer-pop-up-window)
1227 (mode . helpful-mode)) 1305 ;; (mode . helpful-mode))
1228 :norecord))) 1306 ;; :norecord))
1307 )
1229 (:global "<help> f" helpful-callable 1308 (:global "<help> f" helpful-callable
1230 "<help> v" helpful-variable 1309 "<help> v" helpful-variable
1231 "<help> k" helpful-key 1310 "<help> k" helpful-key
diff --git a/lisp/acdw.el b/lisp/acdw.el index 7e82a9a..bd64af3 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -566,5 +566,18 @@ It's called 'require-private' for historical reasons."
566 (forward-sexp 2) 566 (forward-sexp 2)
567 ('scan-error (end-of-buffer)))) 567 ('scan-error (end-of-buffer))))
568 568
569
570;;; Crux tweaks
571
572;; `crux-other-window-or-switch-buffer' doesn't take an argument.
573(defun acdw/other-window-or-switch-buffer (&optional arg)
574 "Call `other-window' or switch buffers, depending on window count."
575 (interactive "P")
576 (if (one-window-p)
577 (switch-to-buffer nil)
578 (other-window (or arg 1))))
579
580
581
569(provide 'acdw) 582(provide 'acdw)
570;;; acdw.el ends here 583;;; acdw.el ends here