1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 03:00:04 +08:00

Add windows resize key binding (#2807)

This commit is contained in:
Wang Shidong 2020-01-29 14:15:29 +08:00 committed by GitHub
parent 1c7566141e
commit cd1ac44984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 0 deletions

View File

@ -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

View File

@ -1010,6 +1010,7 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的
| 快捷键 | 功能描述 |
| --------------------- | ------------------------------------------------------------------------------ |
| `SPC w .` | 启用窗口临时快捷键 |
| `SPC w <Tab>` | 在同一标签内进行窗口切换 |
| `SPC w =` | 对齐分离的窗口 |
| `SPC w b` | force the focus back to the minibuffer (TODO) |

View File

@ -1022,6 +1022,7 @@ Windows manipulation commands (start with `w`):
| Key Bindings | Descriptions |
| --------------------- | ------------------------------------------------------------------------------------------------------------- |
| `SPC w .` | windows transient state |
| `SPC w <Tab>` | 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) |