aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init')
-rw-r--r--vim/init/basic.vim13
1 files changed, 7 insertions, 6 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim
index ab4e89b..344b463 100644
--- a/vim/init/basic.vim
+++ b/vim/init/basic.vim
@@ -107,18 +107,19 @@ endfunction
107nnoremap gl :call ToggleQuit()<CR> 107nnoremap gl :call ToggleQuit()<CR>
108 108
109" Simply exit when closing the last buffer 109" Simply exit when closing the last buffer
110
110function! Bye() 111function! Bye()
111 " Delete current buffer if working on special filetype 112 " Delete current buffer if working on special filetype
112 let specialFileTypes = ['help', 'netrw', 'vim-plug', 'nerdtree'] 113 let specialFileTypes = ['help', 'netrw', 'vim-plug', 'nerdtree']
113 if index(specialFileTypes, &filetype) != -1 114 if index(specialFileTypes, &filetype) != -1
114 :bdelete 115 :bdelete
115 " Delete current buffer if more than one buffers 116 " Delete current buffer if more than one buffers
116 elseif len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) != 1 117 elseif len(getbufinfo(bufnr())[0].windows) == 1 && len(getwininfo()) > 1
117 :bdelete 118 :bdelete
118 elseif g:quitVimWhenPressingCtrlC 119 elseif g:quitVimWhenPressingCtrlC
119 " Otherwise, quit vim 120 " Otherwise, quit vim
120 :silent! qall 121 :silent! quit
121 else 122 else
122 :echo "Press gl to allow quit with <C-c>" 123 :echo "Press gl to allow quit with <C-c>"
123 endif 124 endif
124endfunction 125endfunction