27 lines
760 B
Text
27 lines
760 B
Text
|
" NERDTree
|
||
|
" ========
|
||
|
|
||
|
" Open a NERDTree automatically when vim starts up?
|
||
|
autocmd vimenter * NERDTree
|
||
|
|
||
|
" open a NERDTree automatically when vim starts up if no files were specified?
|
||
|
autocmd StdinReadPre * let s:std_in=1
|
||
|
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
||
|
|
||
|
" Set NERDTree position
|
||
|
let NERDTreeWinPos="left"
|
||
|
|
||
|
" Use as expected with mouse, (dir => single clic, file => double clic)
|
||
|
let NERDTreeMouseMode=2
|
||
|
|
||
|
" Force focus to right buffer
|
||
|
autocmd vimenter * wincmd p
|
||
|
|
||
|
" Close vim if the only window left open is a NERDTree?
|
||
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||
|
|
||
|
" Add shortcuts
|
||
|
nnoremap <Leader>nt :NERDTreeToggle<CR>
|
||
|
nnoremap <Leader>nf :NERDTreeFind<CR>
|
||
|
|