dont open a file twice in the same tab with o mapping

if the user tells the nerd tree to open a file (without splitting), and
that file is already open in the current tab, then just stick the cursor
in the existing window for the file
This commit is contained in:
Martin Grenfell 2008-06-19 22:35:36 +12:00
parent 24ad44b46f
commit 808850a464

View File

@ -2104,7 +2104,12 @@ endfunction
function! s:OpenFileNode(treenode)
call s:PutCursorInTreeWin()
if s:ShouldSplitToOpen(winnr("#"))
"if the file is already open in this tab then just stick the cursor in it
let winnr = bufwinnr(a:treenode.path.StrForOS(0))
if winnr != -1
exec winnr . "wincmd w"
elseif s:ShouldSplitToOpen(winnr("#"))
call s:OpenFileNodeSplit(a:treenode)
else
try