2011-10-07 15 views

Respuesta

137

en: 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. 

no creo que es obligado a nada por defecto, así que hay que haz un keybind tú mismo.

nmap ,n :NERDTreeFind<CR> 

es lo que aparece en mi .vimrc, junto con

nmap ,m :NERDTreeToggle<CR> 
+0

El mapeo de teclas funciona, pero ¿cómo invocar NERDTreeFind dentro de vim? – toszter

+7

@toszter just ': NERDTreeFind' – Thomas

+0

¿Hay alguna manera de configurarlo para hacer esto cada vez que se crea el NERDTree dentro de esa pestaña? –

7

mira esto, automatiza la operación de sincronización, cada vez que cambie de amortiguamiento, la nerdtree se actualiza automáticamente en sí (que copié de here con pequeñas modificaciones)

" 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

Gracias, ¡he estado buscando esto por tanto tiempo! :) – Gnagno

Cuestiones relacionadas