Configure undo-tree

This commit is contained in:
Wojciech Kozlowski 2022-04-11 17:16:13 +02:00
parent ac288e5ad0
commit a3050322ac

View File

@ -161,6 +161,27 @@
;; via ssh. This has to be added last so that it is the first element.
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil)))
;; Configure undo-tree.
(after! undo-tree
;; Doom just gives up on the diff visualizer, because it is impossible to work
;; around undo-tree's window management opinions in a consistent way. For now,
;; hack it to work in some sensible way.
(defadvice! +undo-tree-visualizer-show-diff-a (fn &rest args)
"Display the undo-tree diff buffer underneath undo-tree's parent buffer."
:around #'undo-tree-visualizer-show-diff
(defadvice! +undo-tree-visualizer-diff-split-window-a (&rest _)
"Hack `split-window' to open the diff window where we want it."
:filter-args #'split-window
(list (get-buffer-window undo-tree-visualizer-parent-buffer) nil 'below))
(apply fn args)
(advice-remove 'split-window #'+undo-tree-visualizer-diff-split-window-a))
(setq
;; Don't keep persistent history - that's what git is for.
undo-tree-auto-save-history nil
;; This is nice, but this variables turns nil for some reason after leaving
;; undo-tree. A more consistent experience is to just toggle it with "d".
undo-tree-visualizer-diff nil))
;; The only thing I actually missed from helm.
(map! (:when (featurep! :completion vertico)
:map vertico-map