Ben Schmidt wrote:
>> 1. abbrevs are not triggered by a mapping when remapping is off:
>>
>> " abbrevs not triggered:
>>  :ino <esc> <esc>
>>  :ino <esc> <c-]><esc>
>>
>> " abbrevs triggered as expected:
>>  :imap <esc> <esc>
>>  :imap <esc> <c-]><esc>| " careful, endless loop
>>
>> I'd like to have abbrevs expanded in all situations.
> 
> I think that could be quite 'unsafe' to trigger without an explicit command. 
> The 
> whole point of noremap is to ignore all user customisations so that Vim 
> behaves 
> completely predictably. Expanding abbreviations would undermine this. It 
> wouldn't 
> be so bad in insert mode as in command mode, but it still would be bad.
> 
> But if <C-]> is a command to expand an abbreviation, then indeed, it should 
> surely 
> do so even for a noremap, as that is its function! I would say it's a bug 
> that 
> that doesn't work.

The function of Ctrl-] in insert mode, is to avoid the need to type a further 
character, such as a space, in order to trigger an abbreviation. After an 
abbreviation, Ctrl-] should, according to my understanding, function exactly 
as <Space><BS> by respect to a possible abbreviation.

If a mapping wants its {rhs} to be reinterpreted according to other 
user-defined mappings and abbreviations, then IMHO it should not use noremap.

> 
>> 2. The key i_Ctrl-] is supposed to trigger an abbrev without inserting a
>> character.  Now it does insert itself if there is no abbrev to expand.
>> How is this useful in any way?  IMHO it should never insert itself.
> 
> I would agree with that. If it's a command, it should be a command; if it's 
> not a 
> command, it should insert itself; it shouldn't decide on the spur of the 
> moment 
> which it wants to be. I'd probably call that a bug too.

Hmmm... After an abbreviation, Ctrl-] means "expand the abbreviation without 
the need for me to add, for instance, a space". Now what if there is no 
abbreviation to expand? The circumstances are different then, so I suppose it 
isn't illogical to revert to "standard" insert-mode behaviour, which is to 
insert what you typed. Of course Bram has the final say. Does it work for 
abbreviations if you define

        :map! <C-]> <Space><BS>

? (not sure if :noremap! makes a difference)

BTW, on my keyboard, ] is AltGr-$, Ctrl-$ is $, and AltGr-Ctrl-$ inserts ^] in 
Insert mode (not after an abbrev) but on the command line after an abbrev it 
doesn't expand it: my only abbreviation is

        :cabbrev h bot h

but when I type :h followed by AltGr-Ctrl-$ it doesn't get replaced by :bot h 
-- rather, I get a menu (with 'wildmenu' on) of all ex-commands starting in h 
or H, as if I had typed <Tab> instead of (whatever counts as) Ctrl-]. Is this 
related to the fact that in Normal mode, Ctrl-] goes to the tag under the 
cursor? (AltGr-Ctrl-$ does work for that.) It is in any case in contradiction 
with ":help c_CTRL-]".

> 
> My Vim exhibits the same behaviours.
> 
> Ben.

Best regards,
Tony.
-- 
"Most legislators are so dumb that they couldn't pour piss out of a
boot if the instructions were printed on the heel."


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

Raspunde prin e-mail lui