diff options
Diffstat (limited to 'vim/init')
-rw-r--r-- | vim/init/basic.vim | 13 |
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 | |||
107 | nnoremap gl :call ToggleQuit()<CR> | 107 | nnoremap gl :call ToggleQuit()<CR> |
108 | 108 | ||
109 | " Simply exit when closing the last buffer | 109 | " Simply exit when closing the last buffer |
110 | |||
110 | function! Bye() | 111 | function! 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 |
124 | endfunction | 125 | endfunction |