Update nerdtree settings
parent
5c9823f1f1
commit
6434689998
@ -1,20 +1,31 @@
|
|||||||
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle', 'tag': '6.9.8' }
|
Plug 'preservim/nerdtree', { 'tag': '6.9.11' }
|
||||||
|
|
||||||
" Close all open buffers on entering a window if the only
|
|
||||||
" buffer that's left is the NERDTree buffer
|
|
||||||
function! s:CloseIfOnlyNerdTreeLeft()
|
|
||||||
if exists("t:NERDTreeBufName") &&
|
|
||||||
\ bufwinnr(t:NERDTreeBufName) != -1 &&
|
|
||||||
\ winnr("$") == 1
|
|
||||||
quit
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let g:NERDTreeDirArrowExpandable = '▸'
|
let g:NERDTreeDirArrowExpandable = '▸'
|
||||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||||
|
|
||||||
let NERDTreeDirArrows=1
|
let NERDTreeDirArrows=1
|
||||||
let NERDTreeIgnore = ['\.pyc$', '\.swp$']
|
let NERDTreeIgnore = ['\.swp$']
|
||||||
|
|
||||||
map <leader>nt :NERDTreeToggle<CR>
|
map <leader>nt :NERDTreeToggle<CR>
|
||||||
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
|
|
||||||
|
" Close nerdtree if it's the last buffer
|
||||||
|
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree()
|
||||||
|
\ | quit
|
||||||
|
\ | endif
|
||||||
|
|
||||||
|
" Mirror nerdtree in each tab
|
||||||
|
autocmd BufWinEnter * silent NERDTreeMirror
|
||||||
|
|
||||||
|
" check if reading from stdin
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
|
||||||
|
" open nerdtree if no args in passed to vim
|
||||||
|
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | wincmd p | endif
|
||||||
|
|
||||||
|
" open nerdtree if vim opens to a directory
|
||||||
|
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in')
|
||||||
|
\ | execute 'NERDTree' argv()[0]
|
||||||
|
\ | wincmd p
|
||||||
|
\ | enew
|
||||||
|
\ | execute 'cd '.argv()[0]
|
||||||
|
\ | endif
|
||||||
|
Loading…
Reference in New Issue