extract the tree creation functions out into their own class

Add the NERDTreeCreator class.

Stick all functions related to creating a primary/secondary/mirror
nerdtree in there. We may break this down further in the future, but
this is a good starting point.

Make some of the interface binding functions in autoload/nerdtree
public. This is needed since we are accessing some of them from
NERDTreeCreator. Should be temporary until we get some kind of proper
interface binding system set up.
This commit is contained in:
Martin Grenfell
2013-01-08 00:01:14 +00:00
parent 29d3db8ffe
commit 25b80b8a16
5 changed files with 302 additions and 274 deletions

View File

@@ -144,15 +144,16 @@ runtime plugin/nerdtree/bookmark.vim
runtime plugin/nerdtree/tree_file_node.vim
runtime plugin/nerdtree/tree_dir_node.vim
runtime plugin/nerdtree/opener.vim
runtime plugin/nerdtree/creator.vim
" SECTION: Commands {{{1
"============================================================
"init the command that users start the nerd tree with
command! -n=? -complete=dir -bar NERDTree :call nerdtree#initNerdTree('<args>')
command! -n=? -complete=dir -bar NERDTreeToggle :call nerdtree#toggle('<args>')
command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.New().createPrimary('<args>')
command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.New().togglePrimary('<args>')
command! -n=0 -bar NERDTreeClose :call nerdtree#closeTreeIfOpen()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call nerdtree#initNerdTree('<args>')
command! -n=0 -bar NERDTreeMirror call nerdtree#initNerdTreeMirror()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.New().createPrimary('<args>')
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.New().createMirror()
command! -n=0 -bar NERDTreeFind call nerdtree#findAndRevealPath()
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
@@ -200,7 +201,7 @@ function! NERDTreeFocus()
if nerdtree#isTreeOpen()
call nerdtree#putCursorInTreeWin()
else
call nerdtree#toggle("")
call g:NERDTreeCreator.New().togglePrimary("")
endif
endfunction