Add NERDTreeRefreshRoot command (#897)

* Add NERDTreeRefreshRoot command

* Document NERDTreeRefreshRoot
This commit is contained in:
Werner Hofstra 2018-10-16 17:08:23 +02:00 committed by Phil Runninger
parent 6b6cadf86c
commit 5381197747
2 changed files with 11 additions and 0 deletions

View File

@ -524,10 +524,17 @@ endfunction
" Reloads the current root. All nodes below this will be lost and the root dir
" will be reloaded.
function! s:refreshRoot()
if !g:NERDTree.IsOpen()
return
endif
call nerdtree#echo("Refreshing the root node. This could take a while...")
let l:curWin = winnr()
call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
call b:NERDTree.root.refresh()
call b:NERDTree.render()
redraw
call nerdtree#exec(l:curWin . "wincmd w")
call nerdtree#echo("Refreshing the root node. This could take a while... DONE")
endfunction
@ -554,6 +561,7 @@ function! nerdtree#ui_glue#setupCommands()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
command! -n=0 -bar NERDTreeRefreshRoot call s:refreshRoot()
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
endfunction

View File

@ -145,6 +145,9 @@ The following features and functionality are provided by the NERD tree:
Change the NERDTree root to the current working directory. If no
NERDTree exists for this tab, a new one is opened.
:NERDTreeRefreshRoot *:NERDTreeRefreshRoot*
Refreshes the NERD tree root node.
------------------------------------------------------------------------------
2.2. Bookmarks *NERDTreeBookmarks*