1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 22:20:06 +08:00

Fix iedit key bindings

This commit is contained in:
wsdjeg 2018-04-06 15:37:28 +08:00
parent 459e8904c4
commit bf3b8b7654
2 changed files with 23 additions and 21 deletions

View File

@ -175,7 +175,7 @@ function! s:handle_normal(char) abort
let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g')
endfor
redrawstatus!
elseif a:char == "\<Left>"
elseif a:char == "\<Left>" || a:char == 104
for i in range(len(s:cursor_stack))
if !empty(s:cursor_stack[i].begin)
let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end
@ -183,7 +183,7 @@ function! s:handle_normal(char) abort
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g')
endif
endfor
elseif a:char == "\<Right>"
elseif a:char == "\<Right>" || a:char == 108
for i in range(len(s:cursor_stack))
let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.')
@ -228,10 +228,12 @@ function! s:handle_normal(char) abort
call s:replace_symbol()
elseif a:char == 71 " G
exe s:stack[-1][0]
let s:index = len(s:stack) - 1
elseif a:char == 103 "g
if s:Operator ==# 'g'
exe s:stack[0][0]
let s:Operator = ''
let s:index = 0
else
let s:Operator = 'g'
call s:timeout()

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.
| Key Binding | Description |
| ------------ | ------------------------------------------------------------------------------- |
| `Esc` | go back to `Normal` mode |
| `i` | switch to `iedit-Insert` mode, same as `i` |
| `a` | switch to `iedit-Insert` mode, same as `a` |
| `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 |
| `<Left>` | Move cursor to left |
| `<Right>` | Move cursor to right |
| `0`/`<Home>` | go to the beginning of the current occurrence |
| `$`/`<End>` | go to the end of the current occurrence |
| `D` | delete the occurrences |
| `S` | delete the occurrences and switch to iedit-Insert mode |
| `gg` | go to first occurrence |
| `G` | go to last occurrence |
| `n` | go to next occurrence |
| `N` | go to previous occurrence |
| `p` | replace occurrences with last yanked (copied) text |
| `<Tab>` | toggle current occurrence |
| Key Binding | Description |
| ------------- | ------------------------------------------------------------------------------- |
| `Esc` | go back to `Normal` mode |
| `i` | switch to `iedit-Insert` mode, same as `i` |
| `a` | switch to `iedit-Insert` mode, same as `a` |
| `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 |
| `<Left>`/`h` | Move cursor to left |
| `<Right>`/`l` | Move cursor to right |
| `0`/`<Home>` | go to the beginning of the current occurrence |
| `$`/`<End>` | go to the end of the current occurrence |
| `D` | delete the occurrences |
| `S` | delete the occurrences and switch to iedit-Insert mode |
| `gg` | go to first occurrence |
| `G` | go to last occurrence |
| `n` | go to next occurrence |
| `N` | go to previous occurrence |
| `p` | replace occurrences with last yanked (copied) text |
| `<Tab>` | toggle current occurrence |
**In iedit-Insert mode:**