ansible-role--vim/templates/plugin.nerdtree.vim.j2

27 lines
760 B
Text
Raw Normal View History

" 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>