1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 06:10:05 +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') let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g')
endfor endfor
redrawstatus! redrawstatus!
elseif a:char == "\<Left>" elseif a:char == "\<Left>" || a:char == 104
for i in range(len(s:cursor_stack)) for i in range(len(s:cursor_stack))
if !empty(s:cursor_stack[i].begin) if !empty(s:cursor_stack[i].begin)
let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end 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') let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g')
endif endif
endfor endfor
elseif a:char == "\<Right>" elseif a:char == "\<Right>" || a:char == 108
for i in range(len(s:cursor_stack)) 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].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.') 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() call s:replace_symbol()
elseif a:char == 71 " G elseif a:char == 71 " G
exe s:stack[-1][0] exe s:stack[-1][0]
let s:index = len(s:stack) - 1
elseif a:char == 103 "g elseif a:char == 103 "g
if s:Operator ==# 'g' if s:Operator ==# 'g'
exe s:stack[0][0] exe s:stack[0][0]
let s:Operator = '' let s:Operator = ''
let s:index = 0
else else
let s:Operator = 'g' let s:Operator = 'g'
call s:timeout() 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. `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>`/`h` | Move cursor to left |
| `<Right>` | Move cursor to right | | `<Right>`/`l` | Move cursor to right |
| `0`/`<Home>` | go to the beginning of the current occurrence | | `0`/`<Home>` | go to the beginning of the current occurrence |
| `$`/`<End>` | 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:**