aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2023-06-13 09:47:38 +0800
committerAaron LI <aly@aaronly.me>2023-06-13 10:02:50 +0800
commit4a78be295c8475348642c7cedfdea024c5bcce26 (patch)
tree22d50ab82ad179a6485ad22a85329c94f677d143
parent3264fa9c6c0dc567c337981a83073e5c63178322 (diff)
downloaddotfiles-4a78be295c8475348642c7cedfdea024c5bcce26.tar.bz2
vim: Improve NERDTree config (close tag if the last one)
-rw-r--r--_vim/vimrc2
1 files changed, 2 insertions, 0 deletions
diff --git a/_vim/vimrc b/_vim/vimrc
index 81a3e5f..3d0fdb3 100644
--- a/_vim/vimrc
+++ b/_vim/vimrc
@@ -345,6 +345,8 @@ nnoremap <leader>n :NERDTreeToggle<cr>
" Start NERDTree when Vim is started without file arguments.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
+" Close the tab if NERDTree is the only window remaining in it.
+autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Mappings for Tagbar
nnoremap <leader>t :TagbarToggle<cr>