1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 12:49:10 +08:00

Fix mapping s+Q

This commit is contained in:
wsdjeg 2017-03-10 20:36:26 +08:00
parent b122ddcf32
commit 620a5cb83b
5 changed files with 36 additions and 6 deletions

View File

@ -356,6 +356,9 @@ endfunction
function! SpaceVim#welcome() abort
if exists(':Startify') == 2
Startify
endif
if g:spacevim_enable_vimfiler_welcome
if exists(':VimFiler') == 2
VimFiler
@ -365,9 +368,6 @@ function! SpaceVim#welcome() abort
wincmd p
endif
endif
if exists(':Startify') == 2
Startify
endif
endfunction
""

View File

@ -97,4 +97,28 @@ function! SpaceVim#mapping#vertical_split_previous_buffer() abort
endif
endfunction
" vim:set et sw=2:
function! SpaceVim#mapping#close_current_buffer() abort
let buffers = g:_spacevim_list_buffers
let bn = bufnr('%')
let index = index(buffers, bn)
if index != -1
if index == 0
if len(buffers) > 1
exe 'b' . buffers[1]
exe 'bd' . bn
else
exe 'bd ' . bn
endif
elseif index > 0
if index + 1 == len(buffers)
exe 'b' . buffers[index - 1]
exe 'bd' . bn
else
exe 'b' . buffers[index + 1]
exe 'bd' . bn
endif
endif
endif
endfunction
" vim:set et sw=2 cc=80:

View File

@ -86,7 +86,10 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort
\'Empty current buffer','call zvim#util#BufferEmpty()')
call zvim#util#defineMap('nnoremap <silent>', '[Window]\', ':<C-u>b#<CR>', 'Switch to the last buffer','b#')
call zvim#util#defineMap('nnoremap <silent>', '[Window]q', ':<C-u>close<CR>', 'Close current windows','close')
call zvim#util#defineMap('nnoremap <silent>', '[Window]Q', ':<C-u>bdelete<CR>', 'delete current windows','bdelete')
call zvim#util#defineMap('nnoremap <silent>', '[Window]Q',
\ ':<C-u>call SpaceVim#mapping#close_current_buffer()<CR>',
\ 'delete current windows',
\ 'call SpaceVim#mapping#close_current_buffer()')
call zvim#util#defineMap('nnoremap <silent>', '[Window]c', ':<C-u>call SpaceVim#mapping#clearBuffers()<CR>',
\'Clear all the buffers','call SpaceVim#mapping#clearBuffers()')
endif
@ -135,3 +138,5 @@ function! SpaceVim#mapping#leader#defindUniteLeader(key) abort
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17 -start-insert menu:CustomKeyMaps<CR>
endif
endfunction
" vim:set et sw=2 cc=80:

View File

@ -1,5 +1,6 @@
" @vimlint(EVL103, 1, a:buffers)
function! airline#extensions#tabline#formatters#spacevim#format(bufnr, buffers) abort
let g:_spacevim_list_buffers = a:buffers
" unique_tail_improved
let id = SpaceVim#api#messletters#get().bubble_num(a:bufnr, g:spacevim_buffer_index_type) . ' '
let fn = airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)

View File

@ -306,7 +306,7 @@ Key | Mode | Action
`s`+`o` | Normal | Close other windows (:only)
`s`+`x` | Normal | Remove buffer, leave blank window
`s`+`q` | Normal | Closes current buffer (:close)
`s`+`Q` | Normal | Removes current buffer (:bdelete)
`s`+`Q` | Normal | Removes current buffer, left buffer in the tabline will be displayed, if there is no buffer on the left, the right buffer will be displayed, if this is the last buffer in the tabline, then an empty buffer will be displayed.
`Tab` | Normal | Next window or tab
`Shift`+`Tab` | Normal | Previous window or tab
`<leader>`+`sv` | Normal | Split with previous buffer