NerdTree – 在树中显示文件

是否有一个快捷方式显示NerdTree目录面板中的当前文件。

像TextMate'在抽屉中显示文件' – Ctrl + Command + R

在:h NERDTree:

:NERDTreeFind :NERDTreeFind Find the current file in the tree. If no tree exists for the current tab, or the file is not under the current root, then initialize a new tree where the root is the directory of the current file. 

我不认为这是默认的绑定,所以你必须自己做一个keybind。

 nmap ,n :NERDTreeFind<CR> 

是什么出现在我的.vimrc,随着

 nmap ,m :NERDTreeToggle<CR> 

检查了这一点,它会自动同步操作,每当你改变缓冲区,nerdtree会自动刷新自己(我从这里复制微小的修改)

 " Check if NERDTree is open or active function! IsNERDTreeOpen() return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) endfunction " Call NERDTreeFind iff NERDTree is active, current window contains a modifiable " file, and we're not in vimdiff function! SyncTree() if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff NERDTreeFind wincmd p endif endfunction " Highlight currently open buffer in NERDTree autocmd BufEnter * call SyncTree()