Question

when I show hidden files(I) in the NERDTree. and then :NERDTreeToggle out and :NERDTreeToggle in again. the hidden files will gone. do there have a way to keep the previous state?

Was it helpful?

Solution

I just fixed it myself, for whom have the same problem ~ you can use my adjusted nerdtree version.

or the below patch. I will try to submit a pull request to NERD team. Hopefully they will accept.

index 3a2d71a..debdcb3 100644
--- a/autoload/nerdtree.vim
+++ b/autoload/nerdtree.vim
@@ -1329,6 +1329,7 @@ endfunction
 " toggles the display of bookmarks
 function! s:toggleShowBookmarks()
     let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks
+    let g:NERDTreeShowBookmarks = b:NERDTreeShowBookmarks
     if b:NERDTreeShowBookmarks
         call nerdtree#renderView()
         call nerdtree#putCursorOnBookmarkTable()
@@ -1342,6 +1343,7 @@ endfunction
 " toggles the display of hidden files
 function! s:toggleShowFiles()
     let b:NERDTreeShowFiles = !b:NERDTreeShowFiles
+    let g:NERDTreeShowFiles = b:NERDTreeShowFiles
     call nerdtree#renderViewSavingPosition()
     call nerdtree#centerView()
 endfunction
@@ -1350,6 +1352,7 @@ endfunction
 " toggles the display of hidden files
 function! s:toggleShowHidden()
     let b:NERDTreeShowHidden = !b:NERDTreeShowHidden
+    let g:NERDTreeShowHidden = b:NERDTreeShowHidden
     call nerdtree#renderViewSavingPosition()
     call nerdtree#centerView()
 endfunction
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top