From b905448fbc6d57213820d3d9ee3b6372d4e76366 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Thu, 4 Apr 2019 19:40:07 +0800 Subject: [PATCH] Add: add a new key binding 's' for iedit-model. (#2723) --- autoload/SpaceVim/plugins/iedit.vim | 10 ++++++++++ docs/cn/documentation.md | 1 + docs/documentation.md | 1 + 3 files changed, 12 insertions(+) diff --git a/autoload/SpaceVim/plugins/iedit.vim b/autoload/SpaceVim/plugins/iedit.vim index f0f1cfa7a..cc95accbd 100644 --- a/autoload/SpaceVim/plugins/iedit.vim +++ b/autoload/SpaceVim/plugins/iedit.vim @@ -197,6 +197,16 @@ function! s:handle_normal(char) abort let s:cursor_stack[i].end = '' endfor redrawstatus! + elseif a:char == 115 " s + let s:mode = 'i' + let w:spacevim_iedit_mode = s:mode + let w:spacevim_statusline_mode = 'ii' + for i in range(len(s:cursor_stack)) + let s:cursor_stack[i].begin = s:cursor_stack[i].begin + let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.') + let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g') + endfor + redrawstatus! elseif a:char ==# "\" || a:char == 104 for i in range(len(s:cursor_stack)) if !empty(s:cursor_stack[i].begin) diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index e02f5f0ba..cc6e83729 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1687,6 +1687,7 @@ SpaceVim uses a powerful iedit mode to quick edit multiple occurrences of a symb | `0` / `` | 跳至当前 occurrence 的开头 | | `$` / `` | 跳至当前 occurrence 的结尾 | | `D` | 删除所有 occurrences | +| `s` | 删除所有 occurrences 中光标下的字符 并进入 `iedit-Insert` 模式 | | `S` | 删除所有 occurrences 并进入 `iedit-Insert` 模式 | | `gg` | 跳至第一个 occurrence | | `G` | 跳至最后一个 occurrence | diff --git a/docs/documentation.md b/docs/documentation.md index 3b6dd2fde..c270e0508 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1702,6 +1702,7 @@ The default color for iedit is `red`/`green` which is based on the current color | `0`/`` | go to the beginning of the current occurrence | | `$`/`` | go to the end of the current occurrence | | `D` | delete the occurrences | +| `s` | delete the character under cursor in all the occurrences and switch to iedit-Insert mode | | `S` | delete the occurrences and switch to iedit-Insert mode | | `gg` | go to first occurrence | | `G` | go to last occurrence |