diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 24c6358..507b508 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -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('') command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('') + command! -n=0 -bar NERDTreeRefreshRoot call s:refreshRoot() command! -n=0 -bar NERDTreeFocus call NERDTreeFocus() command! -n=0 -bar NERDTreeCWD call NERDTreeCWD() endfunction diff --git a/doc/NERDTree.txt b/doc/NERDTree.txt index 31f8c57..8f214cb 100644 --- a/doc/NERDTree.txt +++ b/doc/NERDTree.txt @@ -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*