Fix unexpected cursor movement on on-demand imap loading (#1147)

`i_CTRL-O` may change the cursor position in an unexpected way.
For example, when `autoindent` is set, the user will expect that
`i  asdf<CR><C-O>` will place the cursor right below `a`.
However, `<C-O>` moves the cursor to the first column of line 2.

Expected:
```
  asdf
  █
```
Actual:
```
  asdf
█
```

Therefore, it's desirable to use `i_CTRL-\_CTRL-O`, the variant of
`i_CTRL-O` that does not move the cursor.
This commit is contained in:
Jaehwang Jerry Jung 2021-12-06 14:26:19 +09:00 committed by GitHub
parent 93a115718f
commit 68488fd7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -405,7 +405,7 @@ function! plug#end()
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)