mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Improve NERDTree settings
This commit is contained in:
parent
8dedca10d2
commit
b5354fbf4c
|
@ -12,13 +12,13 @@ if empty($DISPLAY) " Use ASCII-only if we're in TTY
|
|||
endif
|
||||
|
||||
" Disable airline in nerdtree buffer
|
||||
augroup filetype_nerdtree
|
||||
au!
|
||||
au FileType nerdtree call s:disable_airline_on_nerdtree()
|
||||
au WinEnter,BufWinEnter,TabEnter * call s:disable_airline_on_nerdtree()
|
||||
augroup END
|
||||
|
||||
fu s:disable_airline_on_nerdtree() abort
|
||||
let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1
|
||||
call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')})
|
||||
endfu
|
||||
"augroup filetype_nerdtree
|
||||
" au!
|
||||
" au FileType nerdtree call s:disable_airline_on_nerdtree()
|
||||
" au WinEnter,BufWinEnter,TabEnter * call s:disable_airline_on_nerdtree()
|
||||
"augroup END
|
||||
"
|
||||
"fu s:disable_airline_on_nerdtree() abort
|
||||
" let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1
|
||||
" call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')})
|
||||
"endfu
|
||||
|
|
|
@ -10,15 +10,17 @@ if empty($DISPLAY) " Disable devicons for nerdtree in TTY
|
|||
let g:webdevicons_enable_nerdtree = 0
|
||||
endif
|
||||
|
||||
"Start NerdTree. If a file is specified, move the cursor to its window.
|
||||
" If a directory is specified, start NERDTree and move the cursor to its window.
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
|
||||
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] |
|
||||
\ endif
|
||||
autocmd VimEnter * if argc() > 0 && !isdirectory(argv()[0]) || exists("s:std_in") |
|
||||
\ execute 'NERDTree' fnamemodify(argv()[0], ':p:h') | wincmd p | endif
|
||||
|
||||
" Exit Vim if NerdTree is the only window left.
|
||||
" If a file is specified, start NERDTree and keep the cursor in file window.
|
||||
"autocmd VimEnter * if argc() > 0 && !isdirectory(argv()[0]) || exists("s:std_in") |
|
||||
" \ execute 'NERDTree' fnamemodify(argv()[0], ':p:h') | wincmd p | endif
|
||||
|
||||
" Exit Vim if NERDTree is the only window left.
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
||||
\ quit | endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue