diff options
-rw-r--r-- | init.el | 111 | ||||
-rw-r--r-- | lisp/acdw.el | 13 |
2 files changed, 108 insertions, 16 deletions
diff --git a/init.el b/init.el index 839caad..ccb35ca 100644 --- a/init.el +++ b/init.el | |||
@@ -380,12 +380,13 @@ Most customizations must go in this function since `eshell' loads | |||
380 | like a dumbass." | 380 | like a dumbass." |
381 | ;; Define keys | 381 | ;; Define keys |
382 | (dolist (spec '(("C-d" . eshell-quit-or-delete-char))) | 382 | (dolist (spec '(("C-d" . eshell-quit-or-delete-char))) |
383 | (define-key eshell-mode-map (kbd (car spec)) (function (cdr spec)))) | 383 | (define-key eshell-mode-map (kbd (car spec)) (cdr spec))) |
384 | ;; Fix modeline | 384 | ;; Fix modeline |
385 | (when (boundp 'simple-modeline--mode-line) | 385 | (when (boundp 'simple-modeline--mode-line) |
386 | (setq mode-line-format '(:eval simple-modeline--mode-line))) | 386 | (setq mode-line-format '(:eval simple-modeline--mode-line))) |
387 | ;; Set outline-regexp for consult-outline | 387 | ;; Make navigating amongst prompts easier |
388 | (setq outline-regexp eshell-prompt-regexp)) | 388 | (setq-local outline-regexp eshell-prompt-regexp |
389 | page-delimiter eshell-prompt-regexp)) | ||
389 | 390 | ||
390 | (defun eshell-buffer-name () | 391 | (defun eshell-buffer-name () |
391 | (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t)) | 392 | (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t)) |
@@ -528,6 +529,7 @@ like a dumbass." | |||
528 | (add-hook 'prog-mode-hook #'goto-address-prog-mode)) | 529 | (add-hook 'prog-mode-hook #'goto-address-prog-mode)) |
529 | 530 | ||
530 | (setup ibuffer | 531 | (setup ibuffer |
532 | (:also-load ibuf-ext) | ||
531 | (:option ibuffer-saved-filter-groups | 533 | (:option ibuffer-saved-filter-groups |
532 | '(("default" | 534 | '(("default" |
533 | ("dired" (mode . dired-mode)) | 535 | ("dired" (mode . dired-mode)) |
@@ -564,11 +566,10 @@ like a dumbass." | |||
564 | (interactive "P") | 566 | (interactive "P") |
565 | (if arg (ibuffer) (electric-buffer-list nil)))) | 567 | (if arg (ibuffer) (electric-buffer-list nil)))) |
566 | 568 | ||
567 | (add-hook 'ibuffer-mode | 569 | (add-hook 'ibuffer-mode-hook |
568 | (defun ibuffer@filter-to-default () | 570 | (defun ibuffer@filter-to-default () |
569 | (ibuffer-switch-to-saved-filter-groups "default"))) | 571 | (ibuffer-switch-to-saved-filter-groups "default"))) |
570 | 572 | ||
571 | (:also-load ibuf-ext) | ||
572 | (:option ibuffer-show-empty-filter-groups nil | 573 | (:option ibuffer-show-empty-filter-groups nil |
573 | ibuffer-expert t)) | 574 | ibuffer-expert t)) |
574 | 575 | ||
@@ -696,7 +697,12 @@ like a dumbass." | |||
696 | (recentf-mode +1)) | 697 | (recentf-mode +1)) |
697 | 698 | ||
698 | (setup repeat | 699 | (setup repeat |
700 | ;; new for Emacs 28! | ||
699 | (:only-if (fboundp #'repeat-mode)) | 701 | (:only-if (fboundp #'repeat-mode)) |
702 | |||
703 | (:option repeat-exit-key "g" | ||
704 | repeat-exit-timeout 5) | ||
705 | |||
700 | (repeat-mode +1)) | 706 | (repeat-mode +1)) |
701 | 707 | ||
702 | (setup (:require savehist) | 708 | (setup (:require savehist) |
@@ -841,9 +847,69 @@ like a dumbass." | |||
841 | (acdw/system :home))) | 847 | (acdw/system :home))) |
842 | recenter-positions '(top middle bottom)) | 848 | recenter-positions '(top middle bottom)) |
843 | 849 | ||
844 | (tooltip-mode -1) | 850 | (tooltip-mode -1)) |
851 | |||
852 | (setup winner | ||
853 | ;; see https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00888.html | ||
854 | (:global "C-x 4 C-/" winner-undo | ||
855 | "C-x 4 /" winner-undo | ||
856 | "C-x 4 C-?" winner-redo | ||
857 | "C-x 4 ?" winner-redo) | ||
858 | |||
859 | ;; add `winner-undo' and `winner-redo' to `repeat-mode' | ||
860 | (when (fboundp 'repeat-mode) | ||
861 | (defvar winner-mode-repeat-map | ||
862 | (let ((map (make-sparse-keymap))) | ||
863 | (define-key map "/" #'winner-undo) | ||
864 | (define-key map "?" #'winner-redo) | ||
865 | map) | ||
866 | "Keymap to repeat `winner-mode' sequences. Used in `repeat-mode'.") | ||
867 | |||
868 | (put 'winner-undo 'repeat-map 'winner-mode-repeat-map) | ||
869 | (put 'winner-redo 'repeat-map 'winner-mode-repeat-map)) | ||
870 | |||
845 | (winner-mode +1)) | 871 | (winner-mode +1)) |
846 | 872 | ||
873 | (setup windmove | ||
874 | (:option windmove-wrap-around t) | ||
875 | (:global | ||
876 | ;; moving | ||
877 | "C-x 4 <left>" windmove-left | ||
878 | "C-x 4 <right>" windmove-right | ||
879 | "C-x 4 <up>" windmove-up | ||
880 | "C-x 4 <down>" windmove-down | ||
881 | ;; swapping | ||
882 | "C-x 4 S-<left>" windmove-swap-states-left | ||
883 | "C-x 4 S-<right>" windmove-swap-states-right | ||
884 | "C-x 4 S-<up>" windmove-swap-states-up | ||
885 | "C-x 4 S-<down>" windmove-swap-states-down) | ||
886 | |||
887 | (when (fboundp 'repeat-mode) | ||
888 | (defvar windmove-repeat-map | ||
889 | (let ((map (make-sparse-keymap))) | ||
890 | ;; moving | ||
891 | (define-key map [left] #'windmove-left) | ||
892 | (define-key map [right] #'windmove-right) | ||
893 | (define-key map [up] #'windmove-up) | ||
894 | (define-key map [down] #'windmove-down) | ||
895 | ;; swapping | ||
896 | (define-key map [S-left] #'windmove-swap-states-left) | ||
897 | (define-key map [S-right] #'windmove-swap-states-right) | ||
898 | (define-key map [S-up] #'windmove-swap-states-up) | ||
899 | (define-key map [S-down] #'windmove-swap-states-down) | ||
900 | map) | ||
901 | "Keymap to repeat various `windmove' sequences. Used in `repeat-mode'.") | ||
902 | |||
903 | (dolist (sym '(windmove-left | ||
904 | windmove-right | ||
905 | windmove-up | ||
906 | windmove-down | ||
907 | windmove-swap-states-left | ||
908 | windmove-swap-states-right | ||
909 | windmove-swap-states-up | ||
910 | windmove-swap-states-down)) | ||
911 | (put sym 'repeat-map 'windmove-repeat-map)))) | ||
912 | |||
847 | (setup w32 | 913 | (setup w32 |
848 | (:option w32-allow-system-shell t | 914 | (:option w32-allow-system-shell t |
849 | w32-pass-lwindow-to-system nil | 915 | w32-pass-lwindow-to-system nil |
@@ -1051,13 +1117,25 @@ like a dumbass." | |||
1051 | (funcall #'vertico-exit))))) | 1117 | (funcall #'vertico-exit))))) |
1052 | 1118 | ||
1053 | (setup (:straight crux) | 1119 | (setup (:straight crux) |
1054 | 1120 | ||
1055 | (:global "M-`" crux-other-window-or-switch-buffer | 1121 | (:global "C-x o" acdw/other-window-or-switch-buffer |
1056 | "C-o" crux-smart-open-line | 1122 | "C-o" crux-smart-open-line |
1057 | "M-o" crux-smart-open-line-above | 1123 | "M-o" crux-smart-open-line-above |
1058 | "C-M-\\" crux-cleanup-buffer-or-region | 1124 | "C-M-\\" crux-cleanup-buffer-or-region |
1059 | "C-x 4 t" crux-transpose-windows) | 1125 | "C-x 4 t" crux-transpose-windows) |
1060 | 1126 | ||
1127 | (when (fboundp 'repeat-mode) | ||
1128 | (define-key other-window-repeat-map "o" | ||
1129 | #'acdw/other-window-or-switch-buffer) | ||
1130 | (define-key other-window-repeat-map "O" | ||
1131 | (defun acdw/other-window-or-switch-buffer-backward () | ||
1132 | (interactive) | ||
1133 | (setq repeat-map 'other-window-repeat-map) | ||
1134 | (acdw/other-window-or-switch-buffer -1))) | ||
1135 | |||
1136 | (put 'acdw/other-window-or-switch-buffer | ||
1137 | 'repeat-map 'other-window-repeat-map)) | ||
1138 | |||
1061 | (crux-reopen-as-root-mode +1)) | 1139 | (crux-reopen-as-root-mode +1)) |
1062 | 1140 | ||
1063 | ;; requires extension: | 1141 | ;; requires extension: |
@@ -1223,14 +1301,15 @@ successive invocations." | |||
1223 | 1301 | ||
1224 | (setup (:straight helpful) | 1302 | (setup (:straight helpful) |
1225 | (:option helpful-max-buffers 5 | 1303 | (:option helpful-max-buffers 5 |
1226 | ;;helpful-switch-buffer-function #'pop-to-buffer | 1304 | helpful-switch-buffer-function #'pop-to-buffer |
1227 | helpful-switch-buffer-function | 1305 | ;; helpful-switch-buffer-function |
1228 | (lambda (buf) | 1306 | ;; (lambda (buf) |
1229 | (pop-to-buffer buf | 1307 | ;; (pop-to-buffer buf |
1230 | '((display-buffer-reuse-mode-window | 1308 | ;; '((display-buffer-reuse-mode-window |
1231 | display-buffer-pop-up-window) | 1309 | ;; display-buffer-pop-up-window) |
1232 | (mode . helpful-mode)) | 1310 | ;; (mode . helpful-mode)) |
1233 | :norecord))) | 1311 | ;; :norecord)) |
1312 | ) | ||
1234 | (:global "<help> f" helpful-callable | 1313 | (:global "<help> f" helpful-callable |
1235 | "<help> v" helpful-variable | 1314 | "<help> v" helpful-variable |
1236 | "<help> k" helpful-key | 1315 | "<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 |