diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 138 |
1 files changed, 92 insertions, 46 deletions
diff --git a/init.el b/init.el index b32dfce..1a39f3c 100644 --- a/init.el +++ b/init.el | |||
@@ -38,11 +38,12 @@ | |||
38 | "C-x o" (lambda () (interactive) (switch-to-buffer nil)) | 38 | "C-x o" (lambda () (interactive) (switch-to-buffer nil)) |
39 | "C-x C-o" #'+open-paragraph | 39 | "C-x C-o" #'+open-paragraph |
40 | "C-w" #'+kill-word-backward-or-region | 40 | "C-w" #'+kill-word-backward-or-region |
41 | "C-x C-1" #'delete-other-windows | 41 | ;; "C-x C-1" #'delete-other-windows |
42 | "C-x 2" #'+split-window-below-then | 42 | ;; "C-x 2" #'+split-window-below-then |
43 | "C-x C-2" #'+split-window-below-then | 43 | ;; "C-x C-2" #'+split-window-below-then |
44 | "C-x 3" #'+split-window-right-then | 44 | ;; "C-x 3" #'+split-window-right-then |
45 | "C-x C-3" #'+split-window-right-then) | 45 | ;; "C-x C-3" #'+split-window-right-then |
46 | ) | ||
46 | ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults | 47 | ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults |
47 | (global-set-key (kbd "C-h") 'delete-backward-char) | 48 | (global-set-key (kbd "C-h") 'delete-backward-char) |
48 | (keyboard-translate ?\C-h ?\C-?) | 49 | (keyboard-translate ?\C-h ?\C-?) |
@@ -58,9 +59,6 @@ | |||
58 | (:bind "C-c s" #'+init-sort-then-save) | 59 | (:bind "C-c s" #'+init-sort-then-save) |
59 | (:hook #'+init-add-setup-to-imenu)) | 60 | (:hook #'+init-add-setup-to-imenu)) |
60 | 61 | ||
61 | (setup (:require +lookup) | ||
62 | (+lookup-mode +1)) | ||
63 | |||
64 | (setup (:require auth-source) | 62 | (setup (:require auth-source) |
65 | (:option auth-sources (list (private/ "authinfo")))) | 63 | (:option auth-sources (list (private/ "authinfo")))) |
66 | 64 | ||
@@ -109,6 +107,9 @@ | |||
109 | (:option pulse-flag nil | 107 | (:option pulse-flag nil |
110 | pulse-delay 0.5 | 108 | pulse-delay 0.5 |
111 | pulse-iterations 1) | 109 | pulse-iterations 1) |
110 | (dolist (command '(+ace-window-or-switch-buffer | ||
111 | pop-mark pop-globl-mark)) | ||
112 | (add-to-list '+pulse-location-commands command)) | ||
112 | (+ensure-after-init #'+pulse-location-mode)) | 113 | (+ensure-after-init #'+pulse-location-mode)) |
113 | 114 | ||
114 | (setup (:require reading) | 115 | (setup (:require reading) |
@@ -137,6 +138,15 @@ | |||
137 | (:option | 138 | (:option |
138 | browse-url-browser-function #'eww-browse-url | 139 | browse-url-browser-function #'eww-browse-url |
139 | +browse-url-browser-function browse-url-browser-function | 140 | +browse-url-browser-function browse-url-browser-function |
141 | browse-url-generic-program (seq-some #'executable-find | ||
142 | '("firefox" | ||
143 | "chromium" | ||
144 | "chrome")) | ||
145 | browse-url-generic-args (seq-some (lambda (e) | ||
146 | (when (equal (executable-find (car e)) | ||
147 | browse-url-generic-program) | ||
148 | (cdr e))) | ||
149 | '(("firefox" "--new-tab"))) | ||
140 | browse-url-secondary-browser-function (if (executable-find "firefox") | 150 | browse-url-secondary-browser-function (if (executable-find "firefox") |
141 | #'browse-url-firefox | 151 | #'browse-url-firefox |
142 | #'browse-url-default-browser) | 152 | #'browse-url-default-browser) |
@@ -230,7 +240,7 @@ | |||
230 | copy move hardlink symlink | 240 | copy move hardlink symlink |
231 | shell touch) | 241 | shell touch) |
232 | dired-dwim-target t) | 242 | dired-dwim-target t) |
233 | (:local-set truncate-lines nil) | 243 | (:local-set truncate-lines t) |
234 | (:bind "<backspace>" #'dired-up-directory | 244 | (:bind "<backspace>" #'dired-up-directory |
235 | "TAB" #'dired-subtree-cycle | 245 | "TAB" #'dired-subtree-cycle |
236 | "i" #'dired-subtree-toggle | 246 | "i" #'dired-subtree-toggle |
@@ -475,13 +485,19 @@ | |||
475 | (with-eval-after-load 'org | 485 | (with-eval-after-load 'org |
476 | (org-clock-persistence-insinuate) | 486 | (org-clock-persistence-insinuate) |
477 | (org-link-set-parameters "tel" :follow #'+org-tel-open)) | 487 | (org-link-set-parameters "tel" :follow #'+org-tel-open)) |
478 | ;; Fancy list bullets | 488 | ;; Extra keywords |
479 | (font-lock-add-keywords | 489 | (font-lock-add-keywords |
480 | 'org-mode | 490 | 'org-mode |
481 | '(("^ *\\([-]\\) " | 491 | '(;; Fancy list bullets |
492 | ("^ *\\([-]\\) " | ||
482 | (0 (compose-region (match-beginning 1) (match-end 1) "•"))) | 493 | (0 (compose-region (match-beginning 1) (match-end 1) "•"))) |
483 | ("^ *\\([+]\\) " | 494 | ("^ *\\([+]\\) " |
484 | (0 (compose-region (match-beginning 1) (match-end 1) "◦")))))) | 495 | (0 (compose-region (match-beginning 1) (match-end 1) "◦")))) |
496 | (with-eval-after-load 'form-feed | ||
497 | ;; Horizontal lines | ||
498 | (font-lock-add-keywords | ||
499 | 'org-mode | ||
500 | '(("^-----+" 0 'form-feed--font-lock-face t)))))) | ||
485 | 501 | ||
486 | (setup org-agenda | 502 | (setup org-agenda |
487 | (:option org-agenda-skip-deadline-if-done t | 503 | (:option org-agenda-skip-deadline-if-done t |
@@ -586,9 +602,6 @@ | |||
586 | (executable-find "diff")) | 602 | (executable-find "diff")) |
587 | (:require apheleia | 603 | (:require apheleia |
588 | +apheleia) | 604 | +apheleia) |
589 | (setf (alist-get 'indent-region apheleia-formatters) #'+apheleia-indent-region | ||
590 | (alist-get 'emacs-lisp-mode apheleia-mode-alist) 'indent-region | ||
591 | (alist-get 'lisp-interaction-mode apheleia-mode-alist) 'indent-region) | ||
592 | (apheleia-global-mode +1)) | 605 | (apheleia-global-mode +1)) |
593 | 606 | ||
594 | (setup (:straight avy) | 607 | (setup (:straight avy) |
@@ -721,9 +734,15 @@ | |||
721 | (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer) | 734 | (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer) |
722 | 735 | ||
723 | (:with-mode circe-chat-mode | 736 | (:with-mode circe-chat-mode |
737 | (:local-set lui-input-function #'+lui-filter) | ||
724 | (:hook #'enable-circe-color-nicks | 738 | (:hook #'enable-circe-color-nicks |
725 | #'enable-circe-new-day-notifier | 739 | #'enable-circe-new-day-notifier |
726 | #'+circe-chat@set-prompt) | 740 | #'+circe-chat@set-prompt |
741 | ;; Filters | ||
742 | #'+circe-F/C-mode | ||
743 | ;; For some reason `+circe-shorten-url-mode' won't work right out of | ||
744 | ;; the gate. | ||
745 | (lambda () (run-with-idle-timer 0.25 nil #'+circe-shorten-url-mode))) | ||
727 | (:bind "C-c C-s" #'circe-command-SLAP)) | 746 | (:bind "C-c C-s" #'circe-command-SLAP)) |
728 | 747 | ||
729 | (:with-mode lui-mode | 748 | (:with-mode lui-mode |
@@ -889,8 +908,7 @@ See also `crux-reopen-as-root-mode'." | |||
889 | (:option dictionary-use-single-buffer t) | 908 | (:option dictionary-use-single-buffer t) |
890 | (autoload 'dictionary-search "dictionary" | 909 | (autoload 'dictionary-search "dictionary" |
891 | "Ask for a word and search it in all dictionaries" t) | 910 | "Ask for a word and search it in all dictionaries" t) |
892 | (:hook #'reading-mode) | 911 | (:hook #'reading-mode)) |
893 | (define-key +lookup-mode-map "d" #'dictionary-search)) | ||
894 | 912 | ||
895 | (setup (:straight (discord | 913 | (setup (:straight (discord |
896 | :host github | 914 | :host github |
@@ -918,12 +936,15 @@ See also `crux-reopen-as-root-mode'." | |||
918 | elfeed-search-title-min-width 24 | 936 | elfeed-search-title-min-width 24 |
919 | elfeed-search-title-max-width 78 | 937 | elfeed-search-title-max-width 78 |
920 | elfeed-show-unique-buffers t | 938 | elfeed-show-unique-buffers t |
921 | elfeed-db-directory (elfeed/ "db/" t)) | 939 | elfeed-db-directory (elfeed/ "db/" t) |
922 | (:+key "C-x w" #'+elfeed) | 940 | elfeed-log 'debug ; until I can figure out syncing... |
941 | ) | ||
942 | (:+key "C-x w" #'elfeed) | ||
923 | (:with-mode elfeed-search-mode | 943 | (:with-mode elfeed-search-mode |
924 | (:hook #'hl-line-mode) | 944 | (:hook #'hl-line-mode) |
925 | ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ | 945 | ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ |
926 | (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)) | 946 | (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) |
947 | (advice-add #'elfeed :before #'elfeed-db-load)) | ||
927 | (:with-mode elfeed-show-mode | 948 | (:with-mode elfeed-show-mode |
928 | (:bind "SPC" #'+elfeed-scroll-up-command | 949 | (:bind "SPC" #'+elfeed-scroll-up-command |
929 | "S-SPC" #'+elfeed-scroll-down-command) | 950 | "S-SPC" #'+elfeed-scroll-down-command) |
@@ -945,14 +966,16 @@ See also `crux-reopen-as-root-mode'." | |||
945 | (setup (:straight elpher)) | 966 | (setup (:straight elpher)) |
946 | 967 | ||
947 | (setup (:straight embark) | 968 | (setup (:straight embark) |
948 | (:also-load +embark) | 969 | (:require embark |
970 | +embark) | ||
949 | (:option prefix-help-command 'embark-prefix-help-command | 971 | (:option prefix-help-command 'embark-prefix-help-command |
950 | embark-keymap-prompter-key ";") | 972 | embark-keymap-prompter-key ";") |
951 | (:+key "C-." #'embark-act | 973 | (:+key "C-." #'embark-act |
952 | "M-." #'embark-dwim | 974 | "M-." #'embark-dwim |
953 | "<f1> B" #'embark-bindings) | 975 | "<f1> B" #'embark-bindings) |
954 | (:with-map minibuffer-local-map | 976 | (:with-map minibuffer-local-map |
955 | (:bind "C-." #'embark-act)) | 977 | (:bind "C-." #'embark-act |
978 | "M-." #'embark-dwim)) | ||
956 | (:with-map embark-file-map | 979 | (:with-map embark-file-map |
957 | (:bind "l" #'vlf))) | 980 | (:bind "l" #'vlf))) |
958 | 981 | ||
@@ -1059,14 +1082,14 @@ See also `crux-reopen-as-root-mode'." | |||
1059 | (:file-match (rx ".rkt" eos) | 1082 | (:file-match (rx ".rkt" eos) |
1060 | (rx ".scm" eos))) | 1083 | (rx ".scm" eos))) |
1061 | 1084 | ||
1062 | (setup (:straight god-mode) | 1085 | ;; (setup (:straight god-mode) |
1063 | (setq god-mode-enable-function-key-translation nil) | 1086 | ;; (setq god-mode-enable-function-key-translation nil) |
1064 | (:require god-mode | 1087 | ;; (:require god-mode |
1065 | +god-mode) | 1088 | ;; +god-mode) |
1066 | (:+key "C-M-g" #'god-mode-all) | 1089 | ;; (:+key "C-M-g" #'god-mode-all) |
1067 | (:with-mode god-local-mode | 1090 | ;; (:with-mode god-local-mode |
1068 | (:bind "i" #'+god-mode-insert | 1091 | ;; (:bind "i" #'+god-mode-insert |
1069 | "a" nil))) | 1092 | ;; "a" nil))) |
1070 | 1093 | ||
1071 | (setup (:straight helpful) | 1094 | (setup (:straight helpful) |
1072 | (run-with-idle-timer 0.5 nil | 1095 | (run-with-idle-timer 0.5 nil |
@@ -1132,17 +1155,9 @@ See also `crux-reopen-as-root-mode'." | |||
1132 | 1155 | ||
1133 | (setup (:straight (lin :host gitlab :repo "protesilaos/lin")) | 1156 | (setup (:straight (lin :host gitlab :repo "protesilaos/lin")) |
1134 | (require 'lin) | 1157 | (require 'lin) |
1135 | (:hook-into dired-mode | 1158 | (dolist (hook lin-foreign-hooks) |
1136 | elfeed-search-mode | 1159 | (add-hook hook #'hl-line-mode) |
1137 | git-rebase-mode | 1160 | (add-hook hook #'lin-mode))) |
1138 | ibuffer-mode | ||
1139 | ledger-report-mode | ||
1140 | log-view-mode | ||
1141 | magit-log-mode | ||
1142 | notmuch-search-mode | ||
1143 | notmuch-tree-mode | ||
1144 | org-agenda-mode | ||
1145 | tabulated-list-mode)) | ||
1146 | 1161 | ||
1147 | (setup (:straight link-hint) | 1162 | (setup (:straight link-hint) |
1148 | (:require +link-hint) | 1163 | (:require +link-hint) |
@@ -1155,6 +1170,11 @@ See also `crux-reopen-as-root-mode'." | |||
1155 | "m" #'link-hint-open-multiple-links | 1170 | "m" #'link-hint-open-multiple-links |
1156 | "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) | 1171 | "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) |
1157 | 1172 | ||
1173 | (setup (:straight macrostep) | ||
1174 | (:require macrostep) | ||
1175 | (:with-mode emacs-lisp-mode | ||
1176 | (:bind "C-c e" #'macrostep-expand))) | ||
1177 | |||
1158 | (setup (:straight marginalia) | 1178 | (setup (:straight marginalia) |
1159 | (marginalia-mode +1)) | 1179 | (marginalia-mode +1)) |
1160 | 1180 | ||
@@ -1306,8 +1326,10 @@ See also `crux-reopen-as-root-mode'." | |||
1306 | :host github | 1326 | :host github |
1307 | :repo "duckwork/titlecase.el" | 1327 | :repo "duckwork/titlecase.el" |
1308 | :files ("*"))) | 1328 | :files ("*"))) |
1309 | (:with-map +casing-mode-map | 1329 | (:require titlecase) |
1310 | (:bind "t" #'titlecase-dwim))) | 1330 | (:with-map +casing-map |
1331 | (:bind "t" #'titlecase-dwim | ||
1332 | "M-t" #'titlecase-dwim))) | ||
1311 | 1333 | ||
1312 | (setup (:straight topsy) | 1334 | (setup (:straight topsy) |
1313 | (:hook-into ;;prog-mode | 1335 | (:hook-into ;;prog-mode |
@@ -1366,11 +1388,35 @@ See also `crux-reopen-as-root-mode'." | |||
1366 | (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) | 1388 | (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) |
1367 | (vertico-mode +1) | 1389 | (vertico-mode +1) |
1368 | ;; Extensions | 1390 | ;; Extensions |
1369 | (:also-load vertico-directory) | 1391 | (:also-load vertico-directory |
1392 | vertico-mouse | ||
1393 | vertico-unobtrusive | ||
1394 | vertico-multiform) | ||
1395 | (vertico-mouse-mode +1) | ||
1396 | (vertico-multiform-mode +1) | ||
1397 | (:option vertico-multiform-commands '((execute-extended-command flat) | ||
1398 | (helpful-callable) | ||
1399 | (helpful-variable)) | ||
1400 | ;; This is applied /after/ the above, so default is at the end of | ||
1401 | ;; this alist. | ||
1402 | vertico-multiform-categories '((file buffer grid) | ||
1403 | (t unobtrusive))) | ||
1404 | (dolist (buf-cmd '(consult-find | ||
1405 | consult-locate | ||
1406 | consult-grep | ||
1407 | consult-git-grep | ||
1408 | consult-ripgrep | ||
1409 | consult-line | ||
1410 | consult-line-multi | ||
1411 | consult-multi-occur | ||
1412 | consult-keep-lines | ||
1413 | consult-focus-lines)) | ||
1414 | (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer))) | ||
1370 | (:with-map vertico-map | 1415 | (:with-map vertico-map |
1371 | (:bind "RET" #'vertico-directory-enter | 1416 | (:bind "RET" #'vertico-directory-enter |
1372 | "DEL" #'vertico-directory-delete-char | 1417 | "DEL" #'vertico-directory-delete-char |
1373 | "M-DEL" #'vertico-directory-delete-word)) | 1418 | "M-DEL" #'vertico-directory-delete-word |
1419 | "TAB" #'+vertico-widen-or-complete)) | ||
1374 | (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) | 1420 | (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) |
1375 | 1421 | ||
1376 | (setup (:straight visual-fill-column) | 1422 | (setup (:straight visual-fill-column) |