Clean up the commentary in "creator.vim"

This commit is contained in:
Jason Franklin 2017-11-11 08:53:47 -05:00
parent 3cb90cb18d
commit d9074c2753

View File

@ -1,11 +1,17 @@
"CLASS: Creator
"Creates tab/window/mirror nerdtree windows. Sets up all the window and
"buffer options and key mappings etc.
"============================================================
" ============================================================================
" CLASS: Creator
"
" This class is responsible for creating NERDTree instances. The new NERDTree
" may be a tab tree, a window tree, or a mirrored tree. In the process of
" creating a NERDTree, it sets up all of the window and buffer options and key
" mappings etc.
" ============================================================================
let s:Creator = {}
let g:NERDTreeCreator = s:Creator
"FUNCTION: s:Creator._bindMappings() {{{1
" FUNCTION: s:Creator._bindMappings() {{{1
function! s:Creator._bindMappings()
"make <cr> do the same as the activate node mapping
nnoremap <silent> <buffer> <cr> :call nerdtree#ui_glue#invokeKeyMap(g:NERDTreeMapActivateNode)<cr>
@ -22,7 +28,7 @@ function! s:Creator._bindMappings()
command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write()
endfunction
"FUNCTION: s:Creator._broadcastInitEvent() {{{1
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
function! s:Creator._broadcastInitEvent()
silent doautocmd User NERDTreeInit
endfunction
@ -32,14 +38,14 @@ function! s:Creator.BufNamePrefix()
return 'NERD_tree_'
endfunction
"FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
function! s:Creator.CreateTabTree(name)
let creator = s:Creator.New()
call creator.createTabTree(a:name)
endfunction
"FUNCTION: s:Creator.createTabTree(a:name) {{{1
"name: the name of a bookmark or a directory
" FUNCTION: s:Creator.createTabTree(a:name) {{{1
" name: the name of a bookmark or a directory
function! s:Creator.createTabTree(name)
let path = self._pathForString(a:name)
@ -74,13 +80,13 @@ function! s:Creator.createTabTree(name)
call self._broadcastInitEvent()
endfunction
"FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
" FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
function! s:Creator.CreateWindowTree(dir)
let creator = s:Creator.New()
call creator.createWindowTree(a:dir)
endfunction
"FUNCTION: s:Creator.createWindowTree(dir) {{{1
" FUNCTION: s:Creator.createWindowTree(dir) {{{1
function! s:Creator.createWindowTree(dir)
try
let path = g:NERDTreePath.New(a:dir)
@ -177,9 +183,9 @@ function! s:Creator.createMirror()
endif
endfunction
"FUNCTION: s:Creator._createTreeWin() {{{1
"Inits the NERD tree window. ie. opens it, sizes it, sets all the local
"options etc
" FUNCTION: s:Creator._createTreeWin() {{{1
" Inits the NERD tree window. ie. opens it, sizes it, sets all the local
" options etc
function! s:Creator._createTreeWin()
"create the nerd tree window
let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright "
@ -198,7 +204,7 @@ function! s:Creator._createTreeWin()
call self._setCommonBufOptions()
endfunction
"FUNCTION: s:Creator._isBufHidden(nr) {{{1
" FUNCTION: s:Creator._isBufHidden(nr) {{{1
function! s:Creator._isBufHidden(nr)
redir => bufs
silent ls!
@ -207,7 +213,7 @@ function! s:Creator._isBufHidden(nr)
return bufs =~ a:nr . '..h'
endfunction
"FUNCTION: s:Creator.New() {{{1
" FUNCTION: s:Creator.New() {{{1
function! s:Creator.New()
let newCreator = copy(self)
return newCreator
@ -232,8 +238,8 @@ function! s:Creator._nextBufferNumber()
return s:Creator._NextBufNum
endfunction
"FUNCTION: s:Creator._pathForString(str) {{{1
"find a bookmark or adirectory for the given string
" FUNCTION: s:Creator._pathForString(str) {{{1
" find a bookmark or adirectory for the given string
function! s:Creator._pathForString(str)
let path = {}
if g:NERDTreeBookmark.BookmarkExistsFor(a:str)
@ -278,7 +284,7 @@ function! s:Creator._removeTreeBufForTab()
unlet t:NERDTreeBufName
endfunction
"FUNCTION: s:Creator._setCommonBufOptions() {{{1
" FUNCTION: s:Creator._setCommonBufOptions() {{{1
function! s:Creator._setCommonBufOptions()
"throwaway buffer options
setlocal noswapfile
@ -310,7 +316,7 @@ function! s:Creator._setCommonBufOptions()
setlocal filetype=nerdtree
endfunction
"FUNCTION: s:Creator._setupStatusline() {{{1
" FUNCTION: s:Creator._setupStatusline() {{{1
function! s:Creator._setupStatusline()
if g:NERDTreeStatusline != -1
let &l:statusline = g:NERDTreeStatusline
@ -335,19 +341,19 @@ function! s:Creator._tabpagevar(tabnr, var)
return v
endfunction
"FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
" FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
function! s:Creator.ToggleTabTree(dir)
let creator = s:Creator.New()
call creator.toggleTabTree(a:dir)
endfunction
"FUNCTION: s:Creator.toggleTabTree(dir) {{{1
"Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is
"closed it is restored or initialized (if it doesnt exist)
" FUNCTION: s:Creator.toggleTabTree(dir) {{{1
" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is
" closed it is restored or initialized (if it doesnt exist)
"
"Args:
"dir: the full path for the root node (is only used if the NERD tree is being
"initialized.
" Args:
" dir: the full path for the root node (is only used if the NERD tree is being
" initialized.
function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen()