Reply to message «Re: [BUG] Having <C-o>c inside a insert mode mapping consumes escape», sent 20:49:05 23 October 2010, Saturday by Bram Moolenaar:
> Nesting is indeed limited to one CTRL-O. Using CTRL-O while already in
> Insert mode because of a CTRL-O doesn't make sense thus it's not
> supported. Mainly because users would get confused because of all the
> nested modes. Hitting Esc and not getting back to Normal mode already
> is confusing if you didn't remember exactly what you were doing.
That does answer a question ``why vim should not have deep nesting'' (and I
totally agree with it), not ``why vim has such nesting at all''.
> I suggest you assume Vim does not have bugs and make it work like that.
> When you can't make it work we need to reconsider.
When I was marking this as a bug, I did not consider that there can be nested
insert modes. After you explained why does it happen, I tried to search the
documentation and found nothing about it. Even more, I do not encounter this
bug
if I press `<C-o>ch' by myself, not inside a mapping:
echo $'a\x0fch-\ea\e:wq! result.txt\n' | vim -u NONE -c 'set nocompatible'
(`\x0f' is `\C-o') results in «-» inside a `result.txt'. Why this does not
yield
the same result as
vim -u NONE -c 'set nocompatible' \
-c 'inoremap $ <C-o>ch-' \
-c 'execute "normal a$\ea"' \
-c 'wq! result.txt'
? I was using <C-o>c{smth} because it is easier to type for me and never
encountered that until I tried to do this in a mapping.
signature.asc
Description: This is a digitally signed message part.
