commit f65bc62fac5123e5ea838d9fecf3211f6b906c53
parent 9b129533431fe046dac50911d0014267b0cdc44c
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Tue, 2 Jun 2009 11:10:03 +1200
fix a bug that was occurring with :set nohidden
previously the code didnt take &hidden (it assumed it was set) into
account when determining if splitting was needed when using the o
mapping on a file node
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -796,12 +796,12 @@ function! s:TreeFileNode.open()
call s:exec(winnr . "wincmd w")
else
- if !s:isWindowUsable(winnr("#")) && s:firstNormalWindow() ==# -1
+ if !s:isWindowUsable(winnr("#")) && s:firstUsableWindow() ==# -1
call self.openSplit()
else
try
if !s:isWindowUsable(winnr("#"))
- call s:exec(s:firstNormalWindow() . "wincmd w")
+ call s:exec(s:firstUsableWindow() . "wincmd w")
else
call s:exec('wincmd p')
endif
@@ -2517,14 +2517,15 @@ function! s:echoError(msg)
call s:echo(a:msg)
echohl normal
endfunction
-"FUNCTION: s:firstNormalWindow(){{{2
+"FUNCTION: s:firstUsableWindow(){{{2
"find the window number of the first normal window
-function! s:firstNormalWindow()
+function! s:firstUsableWindow()
let i = 1
while i <= winnr("$")
let bnum = winbufnr(i)
if bnum != -1 && getbufvar(bnum, '&buftype') ==# ''
\ && !getwinvar(i, '&previewwindow')
+ \ && (!getbufvar(bnum, '&modified') || &hidden)
return i
endif