2011-10-07 4 views

答えて

137

で:時間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. 

私はそれがデフォルトで何にも束縛はないと思うので、あなたがする必要はあり自分でキーバインドを行います。あなたがバッファ変更するたび

nmap ,n :NERDTreeFind<CR> 

nmap ,m :NERDTreeToggle<CR> 
+0

キーマップは機能しますが、vimでNERDTreeFindを呼び出す方法はありますか? – toszter

+7

@toszter just ':NERDTreeFind' – Thomas

+0

NERDTreeがそのタブ内に作成されるたびにこれを行うように設定する方法はありますか? –

7

と一緒にこれをチェックしてください、私の.vimrcに表示される内容である、それは、同期操作を自動化し、nerdtreeは自動的に更新されます(私はhereからコピー小さな変更で)

" 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() 
+0

ありがとう、私はこのような長い時間のためにこれを探してきました! :) – Gnagno

関連する問題