mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Fix #384
This commit is contained in:
parent
44ad1cb4fe
commit
1972bbe974
@ -181,4 +181,30 @@ function! SpaceVim#mapping#close_current_buffer() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! SpaceVim#mapping#close_term_buffer(...) abort
|
||||||
|
let buffers = g:_spacevim_list_buffers
|
||||||
|
let abuf = str2nr(g:_spacevim_termclose_abuf)
|
||||||
|
let index = index(buffers, abuf)
|
||||||
|
let g:wsd = [index, abuf, buffers]
|
||||||
|
if index != -1
|
||||||
|
if index == 0
|
||||||
|
if len(buffers) > 1
|
||||||
|
exe 'b' . buffers[1]
|
||||||
|
exe 'bd!' . abuf
|
||||||
|
else
|
||||||
|
exe 'bd! ' . abuf
|
||||||
|
endif
|
||||||
|
elseif index > 0
|
||||||
|
if index + 1 == len(buffers)
|
||||||
|
exe 'b' . buffers[index - 1]
|
||||||
|
exe 'bd!' . abuf
|
||||||
|
else
|
||||||
|
exe 'b' . buffers[index + 1]
|
||||||
|
exe 'bd!' . abuf
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim:set et sw=2 cc=80:
|
" vim:set et sw=2 cc=80:
|
||||||
|
@ -55,7 +55,7 @@ augroup Terminal
|
|||||||
au!
|
au!
|
||||||
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable
|
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable
|
||||||
au BufWinEnter term://* startinsert | IndentLinesDisable
|
au BufWinEnter term://* startinsert | IndentLinesDisable
|
||||||
au TermClose * exe expand('<abuf>').'bd!'
|
au TermClose * let g:_spacevim_termclose_abuf = expand('<abuf>') | call SpaceVim#mapping#close_term_buffer()
|
||||||
augroup END
|
augroup END
|
||||||
augroup nvimrc_aucmd
|
augroup nvimrc_aucmd
|
||||||
autocmd!
|
autocmd!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user