mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
[fix] quit does not work for 2 windows
If current buf in remaning two or more windows are filetypes in the quit list, we should also quit nvim also.
This commit is contained in:
parent
988cf54f26
commit
e9ffd6c39d
@ -101,10 +101,22 @@ augroup END
|
|||||||
|
|
||||||
" Quit Nvim if we have only one window, and its filetype match our pattern.
|
" Quit Nvim if we have only one window, and its filetype match our pattern.
|
||||||
function! s:quit_current_win() abort
|
function! s:quit_current_win() abort
|
||||||
let quit_filetypes = ['qf', 'vista']
|
let l:quit_filetypes = ['qf', 'vista', 'NvimTree']
|
||||||
let buftype = getbufvar(bufnr(), '&filetype')
|
|
||||||
if winnr('$') == 1 && index(quit_filetypes, buftype) != -1
|
let l:should_quit = v:true
|
||||||
quit
|
|
||||||
|
let l:tabwins = nvim_tabpage_list_wins(0)
|
||||||
|
for w in l:tabwins
|
||||||
|
let l:buf = nvim_win_get_buf(w)
|
||||||
|
let l:bf = getbufvar(l:buf, '&filetype')
|
||||||
|
|
||||||
|
if index(l:quit_filetypes, l:bf) == -1
|
||||||
|
let l:should_quit = v:false
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if l:should_quit
|
||||||
|
qall
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user