aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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>