mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 15:00:48 +08:00
dont clobber "special" windows when opening files
if the user tries to open a file and the previous window is "special" (eg the quickfix window or another explorer plugin) then force a new split to be opened instead
This commit is contained in:
parent
737ad58740
commit
24ad44b46f
|
@ -2450,16 +2450,28 @@ endfunction
|
|||
"Args:
|
||||
"winnumber: the number of the window in question
|
||||
function! s:ShouldSplitToOpen(winnumber)
|
||||
if &hidden
|
||||
return 0
|
||||
"gotta split if theres only one window (i.e. the NERD tree)
|
||||
if winnr("$") == 1
|
||||
return 1
|
||||
endif
|
||||
let oldwinnr = winnr()
|
||||
|
||||
let oldwinnr = winnr()
|
||||
exec a:winnumber . "wincmd p"
|
||||
let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow')
|
||||
let modified = &modified
|
||||
exec oldwinnr . "wincmd p"
|
||||
|
||||
return winnr("$") == 1 || (modified && s:BufInWindows(winbufnr(a:winnumber)) < 2)
|
||||
"if its a special window e.g. quickfix or another explorer plugin then we
|
||||
"have to split
|
||||
if specialWindow
|
||||
return 1
|
||||
endif
|
||||
|
||||
if &hidden
|
||||
return 0
|
||||
endif
|
||||
|
||||
return modified && s:BufInWindows(winbufnr(a:winnumber)) < 2
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:StripMarkupFromLine(line, removeLeadingSpaces){{{2
|
||||
|
|
Loading…
Reference in New Issue
Block a user