Clean up the Creator.createTabTree() function

This commit is contained in:
Jason Franklin 2017-11-11 09:08:24 -05:00
parent d9074c2753
commit 870bedef21

View File

@ -47,33 +47,26 @@ endfunction
" FUNCTION: s:Creator.createTabTree(a:name) {{{1 " FUNCTION: s:Creator.createTabTree(a:name) {{{1
" name: the name of a bookmark or a directory " name: the name of a bookmark or a directory
function! s:Creator.createTabTree(name) function! s:Creator.createTabTree(name)
let path = self._pathForString(a:name) let l:path = self._pathForString(a:name)
"abort if exception was thrown (bookmark/dir doesn't exist) " Abort if an exception was thrown (i.e., if the bookmark or directory
if empty(path) " does not exist).
if empty(l:path)
return return
endif endif
if path == {} " Obey the user's preferences for changing the working directory.
return
endif
"if instructed to, then change the vim CWD to the dir the NERDTree is
"inited in
if g:NERDTreeChDirMode != 0 if g:NERDTreeChDirMode != 0
call path.changeToDir() call l:path.changeToDir()
endif endif
if g:NERDTree.ExistsForTab() if g:NERDTree.ExistsForTab()
if g:NERDTree.IsOpen() call g:NERDTree.Close()
call g:NERDTree.Close()
endif
call self._removeTreeBufForTab() call self._removeTreeBufForTab()
endif endif
call self._createTreeWin() call self._createTreeWin()
call self._createNERDTree(path, "tab") call self._createNERDTree(l:path, 'tab')
call b:NERDTree.render() call b:NERDTree.render()
call b:NERDTree.root.putCursorHere(0, 0) call b:NERDTree.root.putCursorHere(0, 0)