Add advice to indent after a yank

This commit is contained in:
Case Duckworth 2021-12-28 22:15:12 -06:00
parent 5ea81465c3
commit 703e75f385
1 changed files with 8 additions and 2 deletions

10
init.el
View File

@ -33,11 +33,15 @@
"C-c v" 'visible-mode)
;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
(global-set-key (kbd "C-h") 'delete-backward-char)
(keyboard-translate ?\C-h ?\C-?))
(keyboard-translate ?\C-h ?\C-?)
(define-advice keyboard-escape-quit (:around (fn &rest r))
"Don't close splits on `keyboard-escape-quit'."
(let ((buffer-quit-function #'ignore))
(apply fn r)))
(defun +yank@indent (&rest _)
(indent-region (min (point) (mark)) (max (point) (mark))))
(advice-add 'yank :after '+yank@indent)
(advice-add 'yank-pop :after '+yank@indent))
(setup (:require +init)
(:bind "C-c s" (lambda ()
@ -68,7 +72,8 @@
(append +pulse-location-commands) 'lui-track-jump-to-indicator)
(+pulse-location-mode +1))
(setup (:require reading))
(setup (:require reading)
(:+key "C-c C-r" #'reading-mode))
(setup Info
(:hook #'variable-pitch-mode
@ -533,6 +538,7 @@
(define-key isearch-mode-map (car binding) (cdr binding))))
(with-eval-after-load 'org-mode
(define-key org-mode-map "M-g o" 'consult-org-heading))
(advice-add 'consult-yank-pop :after '+yank@indent)
(with-eval-after-load 'consult
(:option consult-narrow-key "<"
consult-project-root-function '+consult-project-root)