如何让VIM的NERDTree保持以前的状态?

时间:2013-08-26 05:10:13

标签: vim nerdtree

当我在NERDTree中显示隐藏文件(I)时。然后:NERDTreeToggle out和:再次出现NERDTreeToggle。隐藏的文件将消失。有没有办法保持以前的状态?

1 个答案:

答案 0 :(得分:1)

我自己修好了, 对于谁有同样的问题〜你可以使用我的adjusted nerdtree版本。

或以下补丁。我将尝试向NERD团队提交拉取请求。希望他们会接受。

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