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

Fix iedit mode

This commit is contained in:
wsdjeg 2018-04-06 15:05:55 +08:00
parent 04eaaa5f74
commit 459e8904c4
2 changed files with 23 additions and 23 deletions

View File

@ -189,16 +189,16 @@ function! s:handle_normal(char) abort
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.') 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') let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g')
endfor endfor
elseif a:char == 48 " 0 elseif a:char == 48 || a:char == "\<Home>" " 0 or <Home>
for i in range(len(s:cursor_stack)) for i in range(len(s:cursor_stack))
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '^.')
let s:cursor_stack[i].end = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '^.', '', 'g') let s:cursor_stack[i].end = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '^.', '', 'g')
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin, '^.')
let s:cursor_stack[i].begin = '' let s:cursor_stack[i].begin = ''
endfor endfor
elseif a:char == 36 " $ elseif a:char == 36 || a:char == "\<End>" " $ or <End>
for i in range(len(s:cursor_stack)) for i in range(len(s:cursor_stack))
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '.$')
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '.$', '', 'g') let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '.$', '', 'g')
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '.$')
let s:cursor_stack[i].end = '' let s:cursor_stack[i].end = ''
endfor endfor
elseif a:char == 68 " D elseif a:char == 68 " D

View File

@ -1553,25 +1553,25 @@ The default color for iedit is `red`/`green` which is based on the current color
`iedit-Normal` mode inherits from `Normal` mode, the following key bindings are specific to `iedit-Normal` mode. `iedit-Normal` mode inherits from `Normal` mode, the following key bindings are specific to `iedit-Normal` mode.
| Key Binding | Description | | Key Binding | Description |
| ----------- | ------------------------------------------------------------------------------- | | ------------ | ------------------------------------------------------------------------------- |
| `Esc` | go back to `Normal` mode | | `Esc` | go back to `Normal` mode |
| `i` | switch to `iedit-Insert` mode, same as `i` | | `i` | switch to `iedit-Insert` mode, same as `i` |
| `a` | switch to `iedit-Insert` mode, same as `a` | | `a` | switch to `iedit-Insert` mode, same as `a` |
| `I` | go to the beginning of the current occurrence and switch to `iedit-Insert` mode | | `I` | go to the beginning of the current occurrence and switch to `iedit-Insert` mode |
| `A` | go to the end of the current occurrence and switch to `iedit-Insert` mode | | `A` | go to the end of the current occurrence and switch to `iedit-Insert` mode |
| `<Left>` | Move cursor to left | | `<Left>` | Move cursor to left |
| `<Right>` | Move cursor to right | | `<Right>` | Move cursor to right |
| `0` | go to the beginning of the current occurrence | | `0`/`<Home>` | go to the beginning of the current occurrence |
| `$` | go to the end of the current occurrence | | `$`/`<End>` | go to the end of the current occurrence |
| `D` | delete the occurrences | | `D` | delete the occurrences |
| `S` | delete the occurrences and switch to iedit-Insert mode | | `S` | delete the occurrences and switch to iedit-Insert mode |
| `gg` | go to first occurrence | | `gg` | go to first occurrence |
| `G` | go to last occurrence | | `G` | go to last occurrence |
| `n` | go to next occurrence | | `n` | go to next occurrence |
| `N` | go to previous occurrence | | `N` | go to previous occurrence |
| `p` | replace occurrences with last yanked (copied) text | | `p` | replace occurrences with last yanked (copied) text |
| `<Tab>` | toggle current occurrence | | `<Tab>` | toggle current occurrence |
**In iedit-Insert mode:** **In iedit-Insert mode:**