I'm using evil (via spacemacs) and I want to bind <f2>
to open and close the undo-tree (like vim-Gundo). I can successfully bind opening undo-tree-visualize
, but I can't figure out how to quit. I tried the obvious:
(define-key evil-normal-state-map (kbd "<f2>") 'undo-tree-visualizer)
(define-key undo-tree-visualizer-mode-map (kbd "<f2>") 'undo-tree-visualizer-quit)
It correctly opens undo-tree but doesn't close it (I get a "no undo information" error). I also tried to hook on load:
(defun my-undo-tree-hook ()
(define-key undo-tree-visualizer-mode-map (kbd "<f2>") 'undo-tree-visualizer-quit))
(add-hook 'undo-tree-visualizer-mode-hook 'my-undo-tree-hook)
But that also doesn't work.
What am I doing wrong?