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

Add buffer selection transient state

This commit is contained in:
wsdjeg 2017-07-22 22:52:15 +08:00
parent 9733fb6da4
commit c8c700efe1
3 changed files with 12 additions and 1 deletions

View File

@ -87,7 +87,7 @@ function! s:self.highlight_title() abort
endfunction
function! s:self._update_content() abort
if self._keys.layout == 'vertical split'
if get(self._keys, 'layout', '') == 'vertical split'
let linenum = max([len(self._keys.right), len(self._keys.left)])
for i in range(linenum)
let left = get(self._keys.left, i)

View File

@ -93,6 +93,9 @@ function! SpaceVim#layers#default#config() abort
\ . string(s:_function('s:jump_to_url')) . ', [])',
\ 'jump to url', 1)
call SpaceVim#mapping#space#def('nnoremap', ['<Tab>'], 'try | b# | catch | endtry', 'last buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call('
\ . string(s:_function('s:buffer_transient_state')) . ', [])',
\ 'buffer transient state', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'],
\ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()',
@ -285,3 +288,10 @@ function! s:delete_current_buffer_file() abort
redraw!
endfunction
function! s:buffer_transient_state() abort
let state = SpaceVim#api#import('transient_state')
call state.set_title('Buffer Selection Transient State')
call state.defind_keys({})
call state.open()
endfunction

View File

@ -759,6 +759,7 @@ Buffer manipulation commands (start with `b`):
Key Binding | Description
----------- | -----------
`SPC TAB` | switch to alternate buffer in the current window (switch back and forth)
`SPC b .` | buffer transient state
`SPC b b` | switch to a buffer (via denite/unite)
`SPC b d` | kill the current buffer (does not delete the visited file)
`SPC u SPC b d` | kill the current buffer and window (does not delete the visited file) (TODO)