mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 13:30:06 +08:00
Add windows resize key binding (#2807)
This commit is contained in:
parent
1c7566141e
commit
cd1ac44984
@ -62,6 +62,9 @@ function! SpaceVim#layers#ui#config() abort
|
|||||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 'b'], 'call call('
|
call SpaceVim#mapping#space#def('nnoremap', ['t', 'b'], 'call call('
|
||||||
\ . string(s:_function('s:toggle_background')) . ', [])',
|
\ . string(s:_function('s:toggle_background')) . ', [])',
|
||||||
\ 'toggle background', 1)
|
\ '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('
|
call SpaceVim#mapping#space#def('nnoremap', ['t', 'c'], 'call call('
|
||||||
\ . string(s:_function('s:toggle_conceallevel')) . ', [])',
|
\ . string(s:_function('s:toggle_conceallevel')) . ', [])',
|
||||||
\ 'toggle conceallevel', 1)
|
\ 'toggle conceallevel', 1)
|
||||||
@ -304,6 +307,79 @@ function! s:toggle_background() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
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
|
let s:enable_sidebar = 0
|
||||||
|
|
||||||
function! SpaceVim#layers#ui#set_variable(var) abort
|
function! SpaceVim#layers#ui#set_variable(var) abort
|
||||||
|
@ -1010,6 +1010,7 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的
|
|||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
| 快捷键 | 功能描述 |
|
||||||
| --------------------- | ------------------------------------------------------------------------------ |
|
| --------------------- | ------------------------------------------------------------------------------ |
|
||||||
|
| `SPC w .` | 启用窗口临时快捷键 |
|
||||||
| `SPC w <Tab>` | 在同一标签内进行窗口切换 |
|
| `SPC w <Tab>` | 在同一标签内进行窗口切换 |
|
||||||
| `SPC w =` | 对齐分离的窗口 |
|
| `SPC w =` | 对齐分离的窗口 |
|
||||||
| `SPC w b` | force the focus back to the minibuffer (TODO) |
|
| `SPC w b` | force the focus back to the minibuffer (TODO) |
|
||||||
|
@ -1022,6 +1022,7 @@ Windows manipulation commands (start with `w`):
|
|||||||
|
|
||||||
| Key Bindings | Descriptions |
|
| 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 <Tab>` | switch to alternate window in the current frame (switch back and forth) |
|
||||||
| `SPC w =` | balance split windows |
|
| `SPC w =` | balance split windows |
|
||||||
| `SPC w b` | force the focus back to the minibuffer (TODO) |
|
| `SPC w b` | force the focus back to the minibuffer (TODO) |
|
||||||
|
Loading…
Reference in New Issue
Block a user