apply Cory Echols' patch

adds :NERDTreeClose command and sets the filetype for the tree buffer to
"nerdtree"
This commit is contained in:
Martin Grenfell
2008-05-17 14:40:27 +12:00
parent 25aaaaae42
commit 04ea2eb0f7
2 changed files with 19 additions and 6 deletions

View File

@@ -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 rendered again. If no NERD tree exists for this tab then this
command acts the same as the |:NERDTree| command. command acts the same as the |:NERDTree| command.
:NERDTreeClose
Close the NERD tree in this tab.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2. NERD tree Mappings *NERDTreeMappings* 2.2. NERD tree Mappings *NERDTreeMappings*
@@ -789,7 +792,9 @@ fridge for later ;)
confused about drives on MF Windows confused about drives on MF Windows
* made the script way better at handling paths with strange characters * made the script way better at handling paths with strange characters
in them (eg '$@; etc) 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 2.8.0
- added an option to enable/disable line numbers in the NERD tree window, - added an option to enable/disable line numbers in the NERD tree window,

View File

@@ -139,6 +139,7 @@ endif
"init the command that users start the nerd tree with "init the command that users start the nerd tree with
command! -n=? -complete=dir NERDTree :call s:InitNerdTree('<args>') command! -n=? -complete=dir NERDTree :call s:InitNerdTree('<args>')
command! -n=? -complete=dir NERDTreeToggle :call s:Toggle('<args>') command! -n=? -complete=dir NERDTreeToggle :call s:Toggle('<args>')
command! -n=0 NERDTreeClose :call s:CloseTreeIfOpen()
" SECTION: Auto commands {{{1 " SECTION: Auto commands {{{1
"============================================================ "============================================================
"Save the cursor position whenever we close the nerd tree "Save the cursor position whenever we close the nerd tree
@@ -1430,7 +1431,13 @@ function! s:CenterView()
endif endif
endif endif
endfunction 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 "FUNCTION: s:CloseTree() {{{2
"Closes the NERD tree window "Closes the NERD tree window
function! s:CloseTree() function! s:CloseTree()
@@ -1481,16 +1488,17 @@ function! s:CreateTreeWin()
setlocal cursorline setlocal cursorline
endif endif
" syntax highlighting
if has("syntax") && exists("g:syntax_on") && !has("syntax_items")
call s:SetupSyntaxHighlighting()
endif
" for line continuation " for line continuation
let cpo_save1 = &cpo let cpo_save1 = &cpo
set cpo&vim set cpo&vim
call s:BindMappings() call s:BindMappings()
setfiletype nerdtree
" syntax highlighting
if has("syntax") && exists("g:syntax_on") && !has("syntax_items")
call s:SetupSyntaxHighlighting()
endif
endfunction endfunction
"FUNCTION: s:DrawTree {{{2 "FUNCTION: s:DrawTree {{{2