diff --git a/autoload/SpaceVim/api/transient_state.vim b/autoload/SpaceVim/api/transient_state.vim index 699bbf796..48b794ca5 100644 --- a/autoload/SpaceVim/api/transient_state.vim +++ b/autoload/SpaceVim/api/transient_state.vim @@ -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) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index 32a0769a3..5e5da556a 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -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', [''], '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 diff --git a/docs/documentation.md b/docs/documentation.md index 95eed0a94..d782e06da 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -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)