diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index ab69fba19..0ce143b5c 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -62,6 +62,9 @@ function! SpaceVim#layers#ui#config() abort call SpaceVim#mapping#space#def('nnoremap', ['t', 'b'], 'call call(' \ . string(s:_function('s:toggle_background')) . ', [])', \ 'toggle background', 1) + call SpaceVim#mapping#space#def('nnoremap', ['w', '.'], 'call call(' + \ . string(s:_function('s:win_resize_transient_state')) . ', [])', + \ 'windows-transient-state', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'c'], 'call call(' \ . string(s:_function('s:toggle_conceallevel')) . ', [])', \ 'toggle conceallevel', 1) @@ -304,6 +307,79 @@ function! s:toggle_background() abort endif endfunction + +function! s:win_resize_transient_state() abort + let state = SpaceVim#api#import('transient_state') + call state.set_title('Windows Resize Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : 'H', + \ 'desc' : 'left', + \ 'func' : '', + \ 'cmd' : 'wincmd h', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'J', + \ 'desc' : 'below', + \ 'func' : '', + \ 'cmd' : 'wincmd j', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'K', + \ 'desc' : 'up', + \ 'func' : '', + \ 'cmd' : 'wincmd k', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'L', + \ 'desc' : 'right', + \ 'func' : '', + \ 'cmd' : 'wincmd l', + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : 'h', + \ 'desc' : 'decrease width', + \ 'func' : '', + \ 'cmd' : 'vertical resize -1', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'l', + \ 'desc' : 'increase width', + \ 'func' : '', + \ 'cmd' : 'vertical resize +1', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'j', + \ 'desc' : 'decrease height', + \ 'func' : '', + \ 'cmd' : 'resize -1', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'k', + \ 'desc' : 'increase height', + \ 'func' : '', + \ 'cmd' : 'resize +1', + \ 'exit' : 0, + \ }, + \ ], + \ } + \ ) + call state.open() +endfunction + + let s:enable_sidebar = 0 function! SpaceVim#layers#ui#set_variable(var) abort diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 016cbc730..cc307d59e 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1010,6 +1010,7 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 | 快捷键 | 功能描述 | | --------------------- | ------------------------------------------------------------------------------ | +| `SPC w .` | 启用窗口临时快捷键 | | `SPC w ` | 在同一标签内进行窗口切换 | | `SPC w =` | 对齐分离的窗口 | | `SPC w b` | force the focus back to the minibuffer (TODO) | diff --git a/docs/documentation.md b/docs/documentation.md index 84516a340..b446f6c82 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1022,6 +1022,7 @@ Windows manipulation commands (start with `w`): | Key Bindings | Descriptions | | --------------------- | ------------------------------------------------------------------------------------------------------------- | +| `SPC w .` | windows transient state | | `SPC w ` | switch to alternate window in the current frame (switch back and forth) | | `SPC w =` | balance split windows | | `SPC w b` | force the focus back to the minibuffer (TODO) |