move isTreeOpen() out of autoload
This commit is contained in:
parent
8270b6d717
commit
0d88ce946f
@ -101,9 +101,7 @@ endfunction
|
|||||||
"FUNCTION: nerdtree#closeTree() {{{2
|
"FUNCTION: nerdtree#closeTree() {{{2
|
||||||
"Closes the primary NERD tree window for this tab
|
"Closes the primary NERD tree window for this tab
|
||||||
function! nerdtree#closeTree()
|
function! nerdtree#closeTree()
|
||||||
if !nerdtree#isTreeOpen()
|
call g:NERDTree.MustBeOpen()
|
||||||
throw "NERDTree.NoTreeFoundError: no NERDTree is open"
|
|
||||||
endif
|
|
||||||
|
|
||||||
if winnr("$") != 1
|
if winnr("$") != 1
|
||||||
if winnr() == g:NERDTree.GetWinNum()
|
if winnr() == g:NERDTree.GetWinNum()
|
||||||
@ -125,7 +123,7 @@ endfunction
|
|||||||
"FUNCTION: nerdtree#closeTreeIfOpen() {{{2
|
"FUNCTION: nerdtree#closeTreeIfOpen() {{{2
|
||||||
"Closes the NERD tree window if it is open
|
"Closes the NERD tree window if it is open
|
||||||
function! nerdtree#closeTreeIfOpen()
|
function! nerdtree#closeTreeIfOpen()
|
||||||
if nerdtree#isTreeOpen()
|
if g:NERDTree.IsOpen()
|
||||||
call nerdtree#closeTree()
|
call nerdtree#closeTree()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -133,7 +131,7 @@ endfunction
|
|||||||
"FUNCTION: nerdtree#closeTreeIfQuitOnOpen() {{{2
|
"FUNCTION: nerdtree#closeTreeIfQuitOnOpen() {{{2
|
||||||
"Closes the NERD tree window if the close on open option is set
|
"Closes the NERD tree window if the close on open option is set
|
||||||
function! nerdtree#closeTreeIfQuitOnOpen()
|
function! nerdtree#closeTreeIfQuitOnOpen()
|
||||||
if g:NERDTreeQuitOnOpen && nerdtree#isTreeOpen()
|
if g:NERDTreeQuitOnOpen && g:NERDTree.IsOpen()
|
||||||
call nerdtree#closeTree()
|
call nerdtree#closeTree()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -275,11 +273,6 @@ function! nerdtree#echoWarning(msg)
|
|||||||
echohl normal
|
echohl normal
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#isTreeOpen() {{{2
|
|
||||||
function! nerdtree#isTreeOpen()
|
|
||||||
return g:NERDTree.GetWinNum() != -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: nerdtree#putCursorOnBookmarkTable(){{{2
|
"FUNCTION: nerdtree#putCursorOnBookmarkTable(){{{2
|
||||||
"Places the cursor at the top of the bookmarks table
|
"Places the cursor at the top of the bookmarks table
|
||||||
function! nerdtree#putCursorOnBookmarkTable()
|
function! nerdtree#putCursorOnBookmarkTable()
|
||||||
@ -306,10 +299,7 @@ endfunction
|
|||||||
"FUNCTION: nerdtree#putCursorInTreeWin(){{{2
|
"FUNCTION: nerdtree#putCursorInTreeWin(){{{2
|
||||||
"Places the cursor in the nerd tree window
|
"Places the cursor in the nerd tree window
|
||||||
function! nerdtree#putCursorInTreeWin()
|
function! nerdtree#putCursorInTreeWin()
|
||||||
if !nerdtree#isTreeOpen()
|
call g:NERDTree.MustBeOpen()
|
||||||
throw "NERDTree.InvalidOperationError: cant put cursor in NERD tree window, no window exists"
|
|
||||||
endif
|
|
||||||
|
|
||||||
call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
|
call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ function! s:findAndRevealPath()
|
|||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path)
|
if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path)
|
||||||
if !nerdtree#isTreeOpen()
|
if !g:NERDTree.IsOpen()
|
||||||
call g:NERDTreeCreator.TogglePrimary('')
|
call g:NERDTreeCreator.TogglePrimary('')
|
||||||
else
|
else
|
||||||
call nerdtree#putCursorInTreeWin()
|
call nerdtree#putCursorInTreeWin()
|
||||||
@ -283,7 +283,7 @@ function! s:findAndRevealPath()
|
|||||||
let b:NERDTreeShowHidden = g:NERDTreeShowHidden
|
let b:NERDTreeShowHidden = g:NERDTreeShowHidden
|
||||||
call s:chRoot(g:NERDTreeDirNode.New(p.getParent()))
|
call s:chRoot(g:NERDTreeDirNode.New(p.getParent()))
|
||||||
else
|
else
|
||||||
if !nerdtree#isTreeOpen()
|
if !g:NERDTree.IsOpen()
|
||||||
call g:NERDTreeCreator.TogglePrimary("")
|
call g:NERDTreeCreator.TogglePrimary("")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -55,7 +55,7 @@ function! s:Creator.createPrimary(name)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if g:NERDTree.ExistsForTab()
|
if g:NERDTree.ExistsForTab()
|
||||||
if nerdtree#isTreeOpen()
|
if g:NERDTree.IsOpen()
|
||||||
call nerdtree#closeTree()
|
call nerdtree#closeTree()
|
||||||
endif
|
endif
|
||||||
unlet t:NERDTreeBufName
|
unlet t:NERDTreeBufName
|
||||||
@ -168,7 +168,7 @@ function! s:Creator.createMirror()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:NERDTree.ExistsForTab() && nerdtree#isTreeOpen()
|
if g:NERDTree.ExistsForTab() && g:NERDTree.IsOpen()
|
||||||
call nerdtree#closeTree()
|
call nerdtree#closeTree()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ endfunction
|
|||||||
"initialized.
|
"initialized.
|
||||||
function! s:Creator.togglePrimary(dir)
|
function! s:Creator.togglePrimary(dir)
|
||||||
if g:NERDTree.ExistsForTab()
|
if g:NERDTree.ExistsForTab()
|
||||||
if !nerdtree#isTreeOpen()
|
if !g:NERDTree.IsOpen()
|
||||||
call self._createTreeWin()
|
call self._createTreeWin()
|
||||||
if !&hidden
|
if !&hidden
|
||||||
call b:NERDTree.render()
|
call b:NERDTree.render()
|
||||||
|
@ -33,6 +33,19 @@ function! s:NERDTree.GetWinNum()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:NERDTree.IsOpen() {{{1
|
||||||
|
function! s:NERDTree.IsOpen()
|
||||||
|
return s:NERDTree.GetWinNum() != -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:NERDTree.MustBeOpen() {{{1
|
||||||
|
function! s:NERDTree.MustBeOpen()
|
||||||
|
if !s:NERDTree.IsOpen()
|
||||||
|
throw "NERDTree.TreeNotOpen"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:NERDTree.New() {{{1
|
||||||
function! s:NERDTree.New(path)
|
function! s:NERDTree.New(path)
|
||||||
let newObj = copy(self)
|
let newObj = copy(self)
|
||||||
let newObj.ui = g:NERDTreeUI.New(newObj)
|
let newObj.ui = g:NERDTreeUI.New(newObj)
|
||||||
|
@ -185,7 +185,7 @@ function! NERDTreeRender()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! NERDTreeFocus()
|
function! NERDTreeFocus()
|
||||||
if nerdtree#isTreeOpen()
|
if g:NERDTree.IsOpen()
|
||||||
call nerdtree#putCursorInTreeWin()
|
call nerdtree#putCursorInTreeWin()
|
||||||
else
|
else
|
||||||
call g:NERDTreeCreator.TogglePrimary("")
|
call g:NERDTreeCreator.TogglePrimary("")
|
||||||
|
Loading…
Reference in New Issue
Block a user