mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:40:06 +08:00
fix(defx): autoclose filetree && skip floating windows
This commit is contained in:
parent
1429dcddbd
commit
f966464168
@ -61,11 +61,21 @@ augroup vfinit
|
||||
autocmd FileType defx call s:defx_init()
|
||||
" auto close last defx windows
|
||||
autocmd BufEnter * nested if
|
||||
\ (!has('vim_starting') && winnr('$') == 1 && g:_spacevim_autoclose_filetree
|
||||
\ (!has('vim_starting') && s:win_count() == 1 && g:_spacevim_autoclose_filetree
|
||||
\ && &filetype ==# 'defx') |
|
||||
\ call s:close_last_vimfiler_windows() | endif
|
||||
augroup END
|
||||
|
||||
function! s:win_count() abort
|
||||
if has('nvim') && exists('*nvim_win_get_config')
|
||||
return len(filter(range(1, winnr('$')), '!has_key(nvim_win_get_config(win_getid(v:val)), "col")'))
|
||||
elseif exists('*popup_getoptions')
|
||||
return len(filter(range(1, winnr('$')), '!has_key(popup_getoptions(win_getid(v:val)), "col")'))
|
||||
else
|
||||
return winnr('$')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" in this function, we should check if shell terminal still exists,
|
||||
" then close the terminal job before close vimfiler
|
||||
function! s:close_last_vimfiler_windows() abort
|
||||
|
Loading…
Reference in New Issue
Block a user