Skip to content

Commit

Permalink
Add NERDTreeRefreshRoot command (#897)
Browse files Browse the repository at this point in the history
* Add NERDTreeRefreshRoot command

* Document NERDTreeRefreshRoot
  • Loading branch information
wgfm authored and PhilRunninger committed Oct 16, 2018
1 parent 6b6cadf commit 5381197
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/nerdtree/ui_glue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/NERDTree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down

0 comments on commit 5381197

Please sign in to comment.