From b13bb4e2d1f883ba7f84bfaa55ad36ef7110c998 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 28 Feb 2023 17:48:48 +0100 Subject: [nvim+git] add diffview --- .config/nvim/plugins/nerdtree.vim | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to '.config/nvim/plugins/nerdtree.vim') diff --git a/.config/nvim/plugins/nerdtree.vim b/.config/nvim/plugins/nerdtree.vim index 8a7869a..57ffba2 100644 --- a/.config/nvim/plugins/nerdtree.vim +++ b/.config/nvim/plugins/nerdtree.vim @@ -3,10 +3,27 @@ let g:NERDTreeGitStatusShowIgnored=1 if !&diff autocmd StdinReadPre * let s:std_in=1 - autocmd VimEnter * NERDTree | if argc() > 0 || exists('s:std_in') | wincmd p | endif - autocmd VimEnter * if argc() > 0 | silent NERDTreeFind | wincmd p | endif endif +function NERDTreeInit() + if !&diff + let buffer_type = getbufvar(bufnr(), "&filetype") + if index(g:NERDTreeNoInitFiletypes, buffer_type) == -1 + NERDTree + + if argc() > 0 || exists('s:std_in') + wincmd p + endif + + if argc() > 0 + silent NERDTreeFind + wincmd p + endif + endif + endif +endfunction +autocmd VimEnter * call NERDTreeInit() + autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -- cgit v1.2.3