 (use-package! undo-tree
   :when (featurep! +tree)
   ;; Branching & persistent undo
-  :after-call doom-switch-buffer-hook after-find-file
+  :hook (doom-first-buffer . global-undo-tree-mode)
   :config
   (setq undo-tree-visualizer-diff t
         undo-tree-auto-save-history t

              (define-key map (kbd "C-x r U") #'undo-fu-session-recover)
              map)
    :init-value nil
    :global t)

  (undo-fu-mode +1))


(use-package! undo-fu-session


(use-package! undo-fu
  :unless (featurep! +tree)
  :hook (doom-first-buffer . undo-fu-mode)
  :init
  ;; `evil' activates undo-tree, so we must pre-emptively disable it.
  (after! undo-tree
