Friday, August 28, 2009

Re: map to in command line

On Fri, Aug 28, 2009 at 6:00 AM, Simson Liu wrote:
>
> Jürgen Krämer wrote:
>
>> this is VI-compatible behavior. In VI pressing <Esc> on the command
>> line executed the command. The only way to cancel a command was to
>> press Ctrl-C. You should thus
>>
>>   :nmap <A-[> <C-C>
>>
>> For more information
>>
>>   :help c_<Esc>
>>   :help c_<CTRL-C>
>>
>> Regards,
>> Jürgen
>>
>
> cnoremap <A-[> <C-C>
>
> The <C-C> did do the work. But I have set no VI-compatible mode. So, the previous mapping behavior should be strange.

As Jürgen said,

:help c_<Esc>

explicitly explains that <Esc> behaves like <CR> in maps or macros, or
when 'cpoptions' contains 'x'. I'm sure the reason for this is that
there's a pretty good bet that if a map does ":w<Esc>" it's a
vi-compatible macro that wants to write the file, meaning that
changing this behavior would break even the most simple vi maps that
users might have wanted to bring forwards, even though it's unlikely
that the user really wanted to do some work and then throw it all
away.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: