make t/T open a new tree in a new tab, not netrw

doesnt work for paths with some screwed up chars in them
This commit is contained in:
Martin Grenfell
2008-07-05 12:15:28 +12:00
parent 3cb3227d56
commit fd487dfa5c

View File

@@ -1486,6 +1486,18 @@ function! s:oPath.StrForGlob() dict
endif endif
return toReturn return toReturn
endfunction endfunction
"FUNCTION: oPath.StrForNERDTreeCmd() {{{3
"
"Return: the string for this path that is suitable to be used with the
":NERDTree command
function! s:oPath.StrForNERDTreeCmd() dict
if s:running_windows
return self.StrForOS(0)
else
return self.Str(1)
endif
endfunction
"FUNCTION: oPath.StrForOS(esc) {{{3 "FUNCTION: oPath.StrForOS(esc) {{{3
" "
"Gets the string path for this path object that is appropriate for the OS. "Gets the string path for this path object that is appropriate for the OS.
@@ -3201,9 +3213,10 @@ function! s:OpenInNewTab(stayCurrentTab)
let treenode = s:GetSelectedNode() let treenode = s:GetSelectedNode()
if treenode != {} if treenode != {}
exec "tabedit " . treenode.path.StrForEditCmd() if treenode.path.isDirectory
if a:stayCurrentTab exec "tabnew +NERDTree\\ " . treenode.path.StrForNERDTreeCmd()
exec "tabnext " . currentTab else
exec "tabedit " . treenode.path.StrForEditCmd()
endif endif
else else
let bookmark = s:GetSelectedBookmark() let bookmark = s:GetSelectedBookmark()
@@ -3213,11 +3226,11 @@ function! s:OpenInNewTab(stayCurrentTab)
else else
exec "tabedit " . bookmark.path.StrForEditCmd() exec "tabedit " . bookmark.path.StrForEditCmd()
endif endif
if a:stayCurrentTab
exec "tabnext " . currentTab
endif
endif endif
endif endif
if a:stayCurrentTab
exec "tabnext " . currentTab
endif
endfunction endfunction
" FUNCTION: s:OpenNodeRecursively() {{{2 " FUNCTION: s:OpenNodeRecursively() {{{2