diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-02-28 17:48:48 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-10-30 09:52:23 +0100 |
commit | b13bb4e2d1f883ba7f84bfaa55ad36ef7110c998 (patch) | |
tree | 5d809bd6d1e96d2541d05693efa1bc974cb568b1 /.config/nvim/plugins/nerdtree.vim | |
parent | 22c4a31a44efa93d02636a77817f6637d273007a (diff) |
[nvim+git] add diffview
Diffstat (limited to '.config/nvim/plugins/nerdtree.vim')
-rw-r--r-- | .config/nvim/plugins/nerdtree.vim | 21 |
1 files changed, 19 insertions, 2 deletions
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 |