From 2f4d1b93e85d0181f7c1be9b1b564a1799308070 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Fri, 9 Jan 2009 14:46:49 +1300 Subject: [PATCH] make the q mapping work with secondary trees --- doc/NERD_tree.txt | 1 + plugin/NERD_tree.vim | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 8e943a3..b3471cf 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -952,6 +952,7 @@ The latest dev versions are on github 3.0.1 - fix a bug where :NERDTreeToggle was broken unless 'hidden was set + - make the q mapping work with secondary (:e style) nerd trees - more insane refactoring and doc updates 3.0.0 diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 65a3133..20cced1 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -3004,7 +3004,7 @@ function! s:bindMappings() exec "nnoremap ". g:NERDTreeMapChdir ." :call chCwd()" - exec "nnoremap ". g:NERDTreeMapQuit ." :NERDTreeToggle" + exec "nnoremap ". g:NERDTreeMapQuit ." :call closeTreeWindow()" exec "nnoremap ". g:NERDTreeMapRefreshRoot ." :call refreshRoot()" exec "nnoremap ". g:NERDTreeMapRefresh ." :call refreshCurrent()" @@ -3162,7 +3162,15 @@ function! s:closeCurrentDir() call treenode.parent.putCursorHere(0, 0) endif endfunction - +" FUNCTION: s:closeTreeWindow() {{{2 +" close the tree window +function! s:closeTreeWindow() + if b:NERDTreeType == "secondary" + buffer # + else + wincmd c + endif +endfunction " FUNCTION: s:copyNode() {{{2 function! s:copyNode() let currentNode = s:TreeFileNode.GetSelected()