From 2cb0fc78fb4c7a1db5f51c042a447cc50f09983d Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Mon, 2 Apr 2012 14:51:19 +0100 Subject: [PATCH] add autocmds for fugitive integration Add 2 autocmds - NERDTreeInit and NERDTreeNewRoot. These are called when a tree is created and when the root is changed. The goal is to give the fugitive plugin something to listen for so it can add the G* commands to nerdtree buffers in git repo dirs. --- plugin/NERD_tree.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 3ec87a0..05c4b46 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -1211,6 +1211,8 @@ function! s:TreeFileNode.makeRoot() if g:NERDTreeChDirMode ==# 2 exec "cd " . b:NERDTreeRoot.path.str({'format': 'Edit'}) endif + + silent doautocmd User NERDTreeNewRoot endfunction "FUNCTION: TreeFileNode.New(path) {{{3 "Returns a new TreeNode object with the given path and parent @@ -3052,11 +3054,12 @@ function! s:initNerdTree(name) let b:NERDTreeShowHidden = g:NERDTreeShowHidden let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks let b:NERDTreeRoot = newRoot - let b:NERDTreeType = "primary" call s:renderView() call b:NERDTreeRoot.putCursorHere(0, 0) + + silent doautocmd User NERDTreeInit endfunction "FUNCTION: s:initNerdTreeInPlace(dir) {{{2 @@ -3086,6 +3089,8 @@ function! s:initNerdTreeInPlace(dir) let b:NERDTreeType = "secondary" call s:renderView() + + silent doautocmd User NERDTreeInit endfunction " FUNCTION: s:initNerdTreeMirror() {{{2 function! s:initNerdTreeMirror()