James Vega wrote:
> On Tue, Jan 08, 2008 at 09:12:24AM +1100, Ben Schmidt wrote:
>>> The builtin Escape key already expands abbrevs.  Isn't this like a part
>>> of its definition?  If I put <esc> on the right side of a noremap, I do
>>> this in order to get this builtin behaviour.
>> I disagree. If *I* put <Esc> on the right hand side of a mapping I do it to 
>> get 
>> the builtin behaviour of 'exit insert mode', not 'change the text in 
>> user-customised ways and then exit insert mode'.
> 
> <Esc> *by default* will trigger an abbr if you're at the end of the
> {lhs}.  So it should still do so when using a noremap.  Using one of the
> help's examples:
> 
>   :ab foo four old otters
>   ifoo<Esc>
> 
> This will leave you with "four old otters" in the buffer (after the
> timeout expires or you press another key).
> 
>> But more importantly, if I put something like "iword " on the right hand 
>> side of a 
>> mapping, I expect 'word' to be inserted, not expanded as an abbreviation. 
>> Much 
>> more important is if I put ':command something' on the right hand side of a 
>> mapping, I expect ':command' to get executed, not something else that the 
>> user has 
>> defined as an abbreviation.
> 
> I think the original poster would agree on this.  His contention was
> that <Esc> isn't following its normal behavior when used in a noremap
> while it does follow normal behavior in a map.

Indeed. My contention is that it actually is following its normal behaviour in 
both--ending insert mode. Abbreviations are a user customisation, just as 
mappings 
are, which modify the normal behaviour of <Esc> when it occurs after certain 
user-defined words. As such, it should be excluded from a noremap, IMHO. The 
whole 
point of a noremap is to avoid such things to get unmodified behaviour, i.e. as 
if 
the user hadn't made customisations. If abbreviations are expanded in a 
noremap, 
suddenly it becomes difficult to reliably enter text using a mapping--you have 
to 
use <C-C> and then re-enter insert mode or insert arrow keys or <C-V> or 
something 
every time you want to end a word, just to avoid it changing due to some 
abbreviation you don't know about.

In my earlier email, pretty much everywhere I wrote 'mapping' I meant a 
'noremap' 
mapping, too; that may well have confused the issue.

Ben.


Send instant messages to your online friends http://au.messenger.yahoo.com 


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

Raspunde prin e-mail lui