On Oct 22, 9:38 am, Christian Brabandt wrote:
> On Fri, October 22, 2010 8:10 am, Andy Koppe wrote:
> > In Cygwin's mintty terminal, I've implemented a feature called
> > "application escape mode" that allows applications to switch the
> > escape key to a non-ambiguous keycode, so as to avoid the need for the
> > escape timeout. It's documented at
> >
http://code.google.com/p/mintty/wiki/CtrlSeqs#Escape_keycode
>
> > A tip athttp://
code.google.com/p/mintty/wiki/Tipsrecommends putting
> > it to use like this:
>
> > let &t_ti.="\e[?7727h"
> > let &t_te.="\e[?7727l"
> > noremap <Esc>O[ <Esc>
> > noremap! <Esc>O[ <Esc>
>
> > This works fine at least in as far as getting out of insert mode is
> > concerned, but unfortunately it doesn't have the desired effect when
> > on the command line. Instead of cancelling a command, pressing Esc
> > appears to have the same effect as pressing Enter, so for example
> > trying to cancel ':q' will quit vim instead.
>
> > Unfortunately I haven't been able to find mappings that make this work
> > properly. Can anyone help?
>
> Do you have 'x' present in your cpoptions?
No. Both with an empty .vimrc, and with the commands above, I get the
following:
cpoptions=aABceFs
> If you do, that is the default
> behaviour of <ESC> in command mode to execute the typed command.
Ah, so it looks like a mapping to <ESC> bypasses the vim default of
cancelling the command and instead goes straight to the vi behaviour
of executing the command, irrespective of the 'x' flag in cpoptions.
Is that as intended?
I also stumbled across what looks like a solution: map the application
escape keycode to ^C instead when in command line (or insert) mode:
let &t_ti.="\e[?7727h"
let &t_te.="\e[?7727l"
noremap <Esc>O[ <Esc>
noremap! <Esc>O[ <C-c>
Does that make sense?
Thanks,
Andy