From e32b57446fc97c0125524ed1f4fe150528ad06ae Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Mon, 12 Apr 2021 23:02:09 +0800 Subject: [PATCH] Add SPC w f for toggle follow mode (#4201) --- autoload/SpaceVim/mapping/space.vim | 38 ++++++++++++++++++----------- docs/cn/documentation.md | 1 + docs/documentation.md | 4 +-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 58fce939b..5fea089c3 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -79,6 +79,16 @@ function! SpaceVim#mapping#space#init() abort \ ] \ , 1) let s:lnum = expand('') + s:funcbeginline + call SpaceVim#mapping#space#def('nnoremap', ['w', 'f'], 'setlocal scrollbind!', + \ ['toggle-follow-mode', + \ [ + \ '[SPC w f] is to toggle follow mode', + \ '', + \ 'Definition: ' . s:file . ':' . s:lnum, + \ ] + \ ] + \ , 1) + let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', 'D'], 'ChooseWin | close | wincmd w', \ ['delete-window-(other-windows)', \ [ @@ -89,27 +99,27 @@ function! SpaceVim#mapping#space#init() abort \ ] \ , 1) let s:lnum = expand('') + s:funcbeginline - call SpaceVim#mapping#space#def('nnoremap', ['w', 'f'], 'tabnew', + call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'], 'tabnew', \ ['create-new-tab', \ [ - \ '[SPC w f] is to create new tab', - \ '', - \ 'Definition: ' . s:file . ':' . s:lnum, - \ ] - \ ] - \ , 1) - let s:lnum = expand('') + s:funcbeginline - call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'], 'call call(' - \ . string(function('s:create_new_named_tab')) - \ . ', [])', - \ ['create-new-named-tab', - \ [ - \ '[SPC w F] is to create new named tab', + \ '[SPC w F] is to create new tab', \ '', \ 'Definition: ' . s:file . ':' . s:lnum, \ ] \ ] \ , 1) +" let s:lnum = expand('') + s:funcbeginline +" call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'], 'call call(' +" \ . string(function('s:create_new_named_tab')) +" \ . ', [])', +" \ ['create-new-named-tab', +" \ [ +" \ '[SPC w F] is to create new named tab', +" \ '', +" \ 'Definition: ' . s:file . ':' . s:lnum, +" \ ] +" \ ] +" \ , 1) let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', 'h'], 'wincmd h', \ ['window-left', diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 2fed22ab1..748418606 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1212,6 +1212,7 @@ SpaceVim 选项 `window_leader` 的值来设为其它按键: | `SPC w C` | 选择某一个窗口,并且进入阅读模式 (需要 tools 模块) | | `SPC w d` | 删除一个窗口 | | `SPC w D` | 选择一个窗口并关闭 | +| `SPC w f` | 切换同步滚屏 | | `SPC w F` | 新建一个新的标签页 | | `SPC w h` | 移至左边窗口 | | `SPC w H` | 将窗口向左移动 | diff --git a/docs/documentation.md b/docs/documentation.md index c56102163..e18a5e83a 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1294,8 +1294,8 @@ Windows manipulation commands (start with `w`): | `SPC w D` | delete another window using vim-choosewin | | `SPC u SPC w D` | delete another window and its current buffer using vim-choosewin (TODO) | | `SPC w t` | toggle window dedication (dedicated window cannot be reused by a mode) (TODO) | -| `SPC w f` | toggle follow mode (TODO) | -| `SPC w F` | create new tab(frame) | +| `SPC w f` | toggle follow mode | +| `SPC w F` | create new tab | | `SPC w h` | move to window on the left | | `SPC w H` | move window to the left | | `SPC w j` | move to window below |