Make neotree cooperate with popups and other window-changing actions

This commit is contained in:
Henrik Lissner 2017-01-08 15:35:50 -05:00
parent ea2372f025
commit f376006284
3 changed files with 24 additions and 4 deletions

View file

@ -60,13 +60,14 @@
(advice-add 'neotree-create-node :around 'doom*neotree-create-node)
;; Prevents messing up the neotree buffer on window changes
(advice-add 'doom/evil-window-move :around 'doom*save-neotree)
(advice-add 'doom/popup-buffer :around 'doom*save-neotree)
;; Adding keybindings to `neotree-mode-map' wouldn't work for me (they get
;; overridden when the neotree buffer is spawned). So we bind them in a hook.
(add-hook 'neo-after-create-hook 'doom|neotree-init-keymap)
(defun doom|neotree-init-keymap (&rest _)
(map! :Lm "\\\\" 'evil-window-prev
:Lm "ESC ESC" 'neotree-hide
:Lm "q" 'neotree-hide
:Lm "ESC ESC" 'doom/neotree-close
:Lm "q" 'doom/neotree-close
:Lm [return] 'neotree-enter
:Lm "RET" 'neotree-enter
:Lm "<return>" 'neotree-enter