From 4a78be295c8475348642c7cedfdea024c5bcce26 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 13 Jun 2023 09:47:38 +0800 Subject: vim: Improve NERDTree config (close tag if the last one) --- _vim/vimrc | 2 ++ 1 file changed, 2 insertions(+) (limited to '_vim') diff --git a/_vim/vimrc b/_vim/vimrc index 81a3e5f..3d0fdb3 100644 --- a/_vim/vimrc +++ b/_vim/vimrc @@ -345,6 +345,8 @@ nnoremap n :NERDTreeToggle " 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 t :TagbarToggle -- cgit v1.2.2