mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
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:
@@ -2104,7 +2104,12 @@ endfunction
|
|||||||
function! s:OpenFileNode(treenode)
|
function! s:OpenFileNode(treenode)
|
||||||
call s:PutCursorInTreeWin()
|
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)
|
call s:OpenFileNodeSplit(a:treenode)
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user