about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-06 22:55:26 -0600
committerCase Duckworth2022-01-06 22:55:26 -0600
commitf0294f7fb4de3fed7e3f14969ebaa1531193361e (patch)
treea05537b5d8a64e46e2d8111f483ceaaa30d4ddcc
parentAdd god-mode (diff)
downloademacs-f0294f7fb4de3fed7e3f14969ebaa1531193361e.tar.gz
emacs-f0294f7fb4de3fed7e3f14969ebaa1531193361e.zip
Lots of other changes
-rw-r--r--init.el32
-rw-r--r--lisp/acdw.el50
2 files changed, 74 insertions, 8 deletions
diff --git a/init.el b/init.el index 970ab83..5fab995 100644 --- a/init.el +++ b/init.el
@@ -37,7 +37,12 @@
37 "M-j" nil 37 "M-j" nil
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
42 "C-x 2" #'+split-window-below-then
43 "C-x C-2" #'+split-window-below-then
44 "C-x 3" #'+split-window-right-then
45 "C-x C-3" #'+split-window-right-then)
41 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults 46 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
42 (global-set-key (kbd "C-h") 'delete-backward-char) 47 (global-set-key (kbd "C-h") 'delete-backward-char)
43 (keyboard-translate ?\C-h ?\C-?) 48 (keyboard-translate ?\C-h ?\C-?)
@@ -741,11 +746,11 @@
741 (:also-load +consult) 746 (:also-load +consult)
742 ;; from Consult wiki 747 ;; from Consult wiki
743 (:option register-preview-delay 0 748 (:option register-preview-delay 0
744 register-preview-function 'consult-register-format 749 register-preview-function #'consult-register-format
745 xref-show-xrefs-function 'consult-xref 750 xref-show-xrefs-function #'consult-xref
746 xref-show-definitions-function 'consult-xref 751 xref-show-definitions-function #'consult-xref
747 tab-always-indent 'complete 752 tab-always-indent 'complete
748 completion-in-region-function 'consult-completion-in-region) 753 completion-in-region-function #'consult-completion-in-region)
749 (advice-add #'register-preview :override #'consult-register-window) 754 (advice-add #'register-preview :override #'consult-register-window)
750 (advice-add #'completing-read-multiple :override 755 (advice-add #'completing-read-multiple :override
751 #'consult-completing-read-multiple) 756 #'consult-completing-read-multiple)
@@ -819,6 +824,12 @@
819 (with-eval-after-load 'orderless 824 (with-eval-after-load 'orderless
820 (:option consult--regexp-compiler 'consult--orderless-regexp-compiler)))) 825 (:option consult--regexp-compiler 'consult--orderless-regexp-compiler))))
821 826
827(setup (:straight consult-dir)
828 (:+key "C-x C-d" #'consult-dir)
829 (:with-map vertico-map
830 (:bind "C-x C-d" #'consult-dir
831 "C-x C-j" #'consult-dir-jump-file)))
832
822(setup (:straight crux) 833(setup (:straight crux)
823 ;; yes it's silly I have an addon to this addon. 834 ;; yes it's silly I have an addon to this addon.
824 (:also-load +crux) 835 (:also-load +crux)
@@ -902,7 +913,8 @@ See also `crux-reopen-as-root-mode'."
902(setup (:straight elpher)) 913(setup (:straight elpher))
903 914
904(setup (:straight embark) 915(setup (:straight embark)
905 (:option prefix-help-command 'embark-prefix-help-command) 916 (:option prefix-help-command 'embark-prefix-help-command
917 embark-keymap-prompter-key ";")
906 (:+key "C-." #'embark-act 918 (:+key "C-." #'embark-act
907 "M-." #'embark-dwim 919 "M-." #'embark-dwim
908 "<f1> B" #'embark-bindings) 920 "<f1> B" #'embark-bindings)
@@ -1162,8 +1174,10 @@ See also `crux-reopen-as-root-mode'."
1162(setup (:straight paredit) 1174(setup (:straight paredit)
1163 (:bind "DEL" #'paredit-backward-delete 1175 (:bind "DEL" #'paredit-backward-delete
1164 "C-<backspace>" #'paredit-backward-kill-word 1176 "C-<backspace>" #'paredit-backward-kill-word
1165 "C-w" (lambda (r) (interactive "P") 1177 "C-w" (lambda (arg) (interactive "P")
1166 (+kill-word-backward-or-region r #'paredit-backward-kill-word))) 1178 (+kill-word-backward-or-region arg
1179 #'paredit-backward-kill-word))
1180 "M-s" nil)
1167 (dolist (hook '(emacs-lisp-mode-hook 1181 (dolist (hook '(emacs-lisp-mode-hook
1168 eval-expression-minibuffer-setup-hook 1182 eval-expression-minibuffer-setup-hook
1169 ielm-mode-hook 1183 ielm-mode-hook
@@ -1224,6 +1238,8 @@ See also `crux-reopen-as-root-mode'."
1224 (simple-modeline-mode +1)) 1238 (simple-modeline-mode +1))
1225 1239
1226(setup (:straight smartscan) 1240(setup (:straight smartscan)
1241 (:with-map smartscan-map
1242 (:bind "M-'" nil))
1227 (:hook-into prog-mode)) 1243 (:hook-into prog-mode))
1228 1244
1229(setup (:straight (sophomore 1245(setup (:straight (sophomore
diff --git a/lisp/acdw.el b/lisp/acdw.el index 8b9c7b9..9361cdf 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -185,5 +185,55 @@ three blank lines, then place the point on the second one."
185 (newline 2) 185 (newline 2)
186 (previous-line))) 186 (previous-line)))
187 187
188(defun +split-window-then (&optional where arg)
189 "Split the window into a new buffer.
190With non-nil ARG (\\[universal-argument] interactively), don't
191prompt for a buffer to switch to. This function will split the
192window using `split-window-sensibly', or open the new window in
193the direction specified by WHERE. WHERE is ignored when called
194interactively; if you want specific splitting, use
195`+split-window-right-then' or `+split-window-below-then'."
196 (interactive "i\nP")
197 ;; TODO: Canceling at the switching phase leaves the point in the other
198 ;; window. Ideally, the user would see this as one action, meaning a cancel
199 ;; would return to the original window.
200 (pcase where
201 ;; These directions are 'backward' to the OG Emacs split-window commands,
202 ;; because by default Emacs leaves the cursor in the original window. Most
203 ;; users probably expect a switch to the new window, at least I do.
204 ((or 'right :right) (split-window-right) (other-window 1))
205 ((or 'left :left) (split-window-right))
206 ((or 'below :below) (split-window-below) (other-window 1))
207 ((or 'above :above) (split-window-below))
208 ((pred null)
209 (or (split-window-sensibly)
210 (if (< (window-height) (window-width))
211 (split-window-below)
212 (split-window-right)))
213 (other-window 1))
214 (_ (user-error "Unknown WHERE paramater: %s" where)))
215 (unless arg
216 (condition-case nil
217 (call-interactively
218 (pcase (read-char "(B)uffer or (F)ile?")
219 (?b (if (fboundp #'consult-buffer)
220 #'consult-buffer
221 #'switch-to-buffer))
222 (?f #'find-file)
223 (_ #'ignore)))
224 (quit (delete-window)))))
225
226(defun +split-window-right-then (&optional arg)
227 "Split window right, then prompt for a new buffer.
228With optional ARG (\\[universal-argument]), just split."
229 (interactive "P")
230 (+split-window-then :right arg))
231
232(defun +split-window-below-then (&optional arg)
233 "Split window below, then prompt for a new buffer.
234With optional ARG (\\[universal-argument]), just split."
235 (interactive "P")
236 (+split-window-then :below arg))
237
188(provide 'acdw) 238(provide 'acdw)
189;;; acdw.el ends here 239;;; acdw.el ends here