From d9091ed49cda30b17d41f435c14960f3433fa60b Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 20 Jun 2024 00:26:26 +0800 Subject: Update --- vim/init/basic.vim | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'vim/init/basic.vim') diff --git a/vim/init/basic.vim b/vim/init/basic.vim index 09ed985..eb895e2 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim @@ -109,19 +109,19 @@ nnoremap gl :call ToggleQuit() " Simply exit when closing the last buffer function! Bye() - " Delete current buffer if working on special filetype - let specialFileTypes = ['help', 'netrw', 'vim-plug', 'nerdtree'] - if index(specialFileTypes, &filetype) != -1 - :bdelete - " Delete current buffer if more than one buffers - elseif len(getbufinfo(bufnr())[0].windows) == 1 && len(getwininfo()) > 1 - :bdelete - elseif g:quitVimWhenPressingCtrlC - " Otherwise, quit vim - :silent! quit + let specialFileTypes = ['help', 'netrw', 'vim-plug', 'nerdtree'] + let bufIsSpecial = index(specialFileTypes, &filetype) != -1 + let bufInMultipleWindow = len(getbufinfo(bufnr())[0].windows) > 1 + + if len(getbufinfo({'buflisted': 1})) == 1 && len(getwininfo()) == 1 + if g:quitVimWhenPressingCtrlC + :silent! quit else - :echo "Press gl to allow quit with " + :echo "Press gl to allow quit with " endif + else + :bdelete + endif endfunction " Ctrl-C rules!!! -- cgit v1.2.3-70-g09d2