On Do, 01 Nov 2018, Ingo Karkat wrote:

> On 30-Oct-2018 07:48 +0100, Christian Brabandt wrote:
> 
> > On Mo, 29 Okt 2018, Bok Woon Chua wrote:
> > 
> >> I have an autocmd that saves the current file on InsertLeave.
> >> Using C-c in insert mode doesn't trigger this save (as desired),
> >> but if I use it into an inoremap mapping like so
> >> 
> >> inoremap <C-a> <C-c>I
> >> 
> >> ,it triggers InsertLeave whenever I use C-a to jump to the start
> >> of the line and hence saves the file.
> >> 
> >> Is this intentional behavior? Is C-c supposed to avoid
> >> InsertLeave only if used interactively, rather than in a script?
> > 
> > I believe this is intentionally and expected. <c-c> does not work
> > as "abort" key if it comes from a mapping (or has been mapped).
> 
> Yes, that is the current behavior, but I agree with Bok Woon Chua that
> this is unexpected and inconsistent with how other mappings behave (i.e.
> they transparently forward the original behavior without changing it).
> The problem even occurs when mapping <C-c> onto itself (:inoremap <C-c>
> <C-c>).

Well, it's an inconsistency, that has been there for years and actually 
think one should not map C-C at all for exact that reason. Have you 
tried letting feedkeys() return `<c-c>`? I think that might actually 
work.

BTW: There is another inconsistency, that is, that ESC that comes from a 
mapping execute the current commandline instead of aborting it.

Best,
Christian
-- 
Es gibt keine Menschen, die sich besser verstehen als Priester und
Soldaten.
                -- Napoleon I. Bonaparte

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui