commit 04ea2eb0f713105398aad9a9f3e011e68f098341
parent 25aaaaae425079a5ececfa3f375c870d20dd535e
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Sat, 17 May 2008 14:40:27 +1200
apply Cory Echols' patch
adds :NERDTreeClose command and sets the filetype for the tree buffer to
"nerdtree"
Diffstat:
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt
@@ -96,6 +96,9 @@ The following features and functionality are provided by the NERD tree:
rendered again. If no NERD tree exists for this tab then this
command acts the same as the |:NERDTree| command.
+:NERDTreeClose
+ Close the NERD tree in this tab.
+
------------------------------------------------------------------------------
2.2. NERD tree Mappings *NERDTreeMappings*
@@ -789,7 +792,9 @@ fridge for later ;)
confused about drives on MF Windows
* made the script way better at handling paths with strange characters
in them (eg '$@; etc)
-
+ - applied a patch from Cory Echols
+ * add the command :NERDTreeClose to close the tree for the current tab
+ * set the filetype for the NERD tree buffer to "nerdtree"
2.8.0
- added an option to enable/disable line numbers in the NERD tree window,
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -139,6 +139,7 @@ endif
"init the command that users start the nerd tree with
command! -n=? -complete=dir NERDTree :call s:InitNerdTree('<args>')
command! -n=? -complete=dir NERDTreeToggle :call s:Toggle('<args>')
+command! -n=0 NERDTreeClose :call s:CloseTreeIfOpen()
" SECTION: Auto commands {{{1
"============================================================
"Save the cursor position whenever we close the nerd tree
@@ -1430,7 +1431,13 @@ function! s:CenterView()
endif
endif
endfunction
-
+"FUNCTION: s:CloseTreeIfOpen() {{{2
+"Closes the NERD tree window if it is open
+function! s:CloseTreeIfOpen()
+ if s:IsTreeOpen()
+ call s:CloseTree()
+ endif
+endfunction
"FUNCTION: s:CloseTree() {{{2
"Closes the NERD tree window
function! s:CloseTree()
@@ -1481,16 +1488,17 @@ function! s:CreateTreeWin()
setlocal cursorline
endif
- " syntax highlighting
- if has("syntax") && exists("g:syntax_on") && !has("syntax_items")
- call s:SetupSyntaxHighlighting()
- endif
" for line continuation
let cpo_save1 = &cpo
set cpo&vim
call s:BindMappings()
+ setfiletype nerdtree
+ " syntax highlighting
+ if has("syntax") && exists("g:syntax_on") && !has("syntax_items")
+ call s:SetupSyntaxHighlighting()
+ endif
endfunction
"FUNCTION: s:DrawTree {{{2