Skip to content

Commit 5f5c4ad

Browse files
committed
update autocmd.vim
Automatically quit vim if actual files are closed.
1 parent eb47e83 commit 5f5c4ad

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

config/autocmd.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,24 @@ autocmd BufRead,BufNewFile .jshintrc setfiletype json
1919
"autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
2020
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
2121

22+
function! CheckLeftBuffers()
23+
if tabpagenr('$') == 1
24+
let i = 1
25+
while i <= winnr('$')
26+
if getbufvar(winbufnr(i), '&buftype') == 'help' ||
27+
\ getbufvar(winbufnr(i), '&buftype') == 'quickfix' ||
28+
\ exists('t:NERDTreeBufName') &&
29+
\ bufname(winbufnr(i)) == t:NERDTreeBufName ||
30+
\ bufname(winbufnr(i)) == '__Tag_List__'
31+
let i += 1
32+
else
33+
break
34+
endif
35+
endwhile
36+
if i == winnr('$') + 1
37+
qall
38+
endif
39+
unlet i
40+
endif
41+
endfunction
42+
autocmd BufEnter * call CheckLeftBuffers()

0 commit comments

Comments
 (0)