aboutsummaryrefslogtreecommitdiff
path: root/evil-integration.el
diff options
context:
space:
mode:
Diffstat (limited to 'evil-integration.el')
-rw-r--r--evil-integration.el17
1 files changed, 16 insertions, 1 deletions
diff --git a/evil-integration.el b/evil-integration.el
index 12540a0..5491960 100644
--- a/evil-integration.el
+++ b/evil-integration.el
@@ -206,7 +206,22 @@
"k" 'evil-previous-line
"RET" 'ibuffer-visit-buffer)))
-;;; Undo tree visualizer
+;;; Undo tree
+(when (and (require 'undo-tree nil t)
+ (fboundp 'global-undo-tree-mode))
+ (global-undo-tree-mode 1))
+
+(defun evil-turn-on-undo-tree-mode ()
+ "Enable `undo-tree-mode' if evil is enabled.
+This function enables `undo-tree-mode' when Evil is activated in
+some buffer, but only if `global-undo-tree-mode' is also
+activated."
+ (when (and (boundp 'global-undo-tree-mode)
+ (fboundp 'undo-tree-mode)
+ global-undo-tree-mode)
+ (undo-tree-mode 1)))
+
+(add-hook 'evil-local-mode-hook #'evil-turn-on-undo-tree-mode)
(defadvice undo-tree-visualize (after evil activate)
"Initialize Evil in the visualization buffer."