commit fd487dfa5ccf78134871c7363054dbc84f287c56
parent 3cb3227d56959cca112f20973b41327213e3ba5a
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Sat, 5 Jul 2008 12:15:28 +1200
make t/T open a new tree in a new tab, not netrw
doesnt work for paths with some screwed up chars in them
Diffstat:
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -1486,6 +1486,18 @@ function! s:oPath.StrForGlob() dict
endif
return toReturn
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
"
"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()
if treenode != {}
- exec "tabedit " . treenode.path.StrForEditCmd()
- if a:stayCurrentTab
- exec "tabnext " . currentTab
+ if treenode.path.isDirectory
+ exec "tabnew +NERDTree\\ " . treenode.path.StrForNERDTreeCmd()
+ else
+ exec "tabedit " . treenode.path.StrForEditCmd()
endif
else
let bookmark = s:GetSelectedBookmark()
@@ -3213,11 +3226,11 @@ function! s:OpenInNewTab(stayCurrentTab)
else
exec "tabedit " . bookmark.path.StrForEditCmd()
endif
- if a:stayCurrentTab
- exec "tabnext " . currentTab
- endif
endif
endif
+ if a:stayCurrentTab
+ exec "tabnext " . currentTab
+ endif
endfunction
" FUNCTION: s:OpenNodeRecursively() {{{2