mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
feat(mapping): make SPC b d
skip startify and defx buffer
This commit is contained in:
parent
54f5bfc186
commit
43674200ef
@ -179,6 +179,11 @@ function! SpaceVim#mapping#vertical_split_previous_buffer(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#close_current_buffer(...) abort
|
function! SpaceVim#mapping#close_current_buffer(...) abort
|
||||||
|
if index(
|
||||||
|
\ ['startify', 'defx'],
|
||||||
|
\ &filetype) !=# -1
|
||||||
|
return
|
||||||
|
endif
|
||||||
let buffers = get(g:, '_spacevim_list_buffers', [])
|
let buffers = get(g:, '_spacevim_list_buffers', [])
|
||||||
let bn = bufnr('%')
|
let bn = bufnr('%')
|
||||||
let f = ''
|
let f = ''
|
||||||
@ -235,9 +240,17 @@ function! SpaceVim#mapping#close_current_buffer(...) abort
|
|||||||
exe cmd_close_buf . bn
|
exe cmd_close_buf . bn
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if len(buffers) >= 1
|
if len(buffers) > 1
|
||||||
exe 'bp'
|
exe 'bp'
|
||||||
exe cmd_close_buf . bn
|
exe cmd_close_buf . bn
|
||||||
|
elseif len(buffers) ==# 1
|
||||||
|
if exists(':Startify') ==# 2
|
||||||
|
Startify
|
||||||
|
endif
|
||||||
|
try
|
||||||
|
exe cmd_close_buf . bn
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
else
|
else
|
||||||
exe cmd_close_buf . bn
|
exe cmd_close_buf . bn
|
||||||
if exists(':Startify') ==# 2
|
if exists(':Startify') ==# 2
|
||||||
@ -307,14 +320,14 @@ endfunction
|
|||||||
function! SpaceVim#mapping#clear_saved_buffers() abort
|
function! SpaceVim#mapping#clear_saved_buffers() abort
|
||||||
call s:BUFFER.filter_do(
|
call s:BUFFER.filter_do(
|
||||||
\ {
|
\ {
|
||||||
\ 'expr' : [
|
\ 'expr' : [
|
||||||
\ 'buflisted(v:val)',
|
\ 'buflisted(v:val)',
|
||||||
\ 'index(tabpagebuflist(), v:val) == -1',
|
\ 'index(tabpagebuflist(), v:val) == -1',
|
||||||
\ 'getbufvar(v:val, "&mod") == 0',
|
\ 'getbufvar(v:val, "&mod") == 0',
|
||||||
\ ],
|
\ ],
|
||||||
\ 'do' : 'noautocmd bd %d'
|
\ 'do' : 'noautocmd bd %d'
|
||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#format() abort
|
function! SpaceVim#mapping#format() abort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user