Thursday, July 14, 2011

Re: Abbreviations using special chars

On Wed, 13 Jul 2011, Christian Brabandt wrote:

> On Tue, July 12, 2011 5:38 pm, Nathan Neff wrote:
>> Interestingly, if I use:
>>
>> iabbrev <lt>s whatever
>>
>> it works.
>
> This means, when vim parses this iabbrev, it will replace the <lt> by
> '<', so you trigger your abbreviation by typing <s (as you probably
> already know, just want to point out the obvious).

But why is it necessary to use <lt> for Nathan? If I put the original
line:

iabbrev <s #+begin_src groovy

into my .vimrc, it works fine. I even wrapped it in :set cp and :set
nocp, fiddled with the '<' and 'k' options of 'cpo', and tried varied
settings for 'isk' and 'isi'.

:help <>
#3 states that: "When there is no confusion possible, a '<' can be used
directly."

Is something ambiguous about '<s'?

Nathan, can you try this modification?

iabbrev <w #+begin_src groovy

(curious if the 's' is being interpreted as shift (:help shift))


>> If I use
>>
>> iabbrev <lt>sg whatever then it fails with "Invalid argument". It
>> looks like vim trips up if the abbreviation is > 2 chars if I'm using
>> the <lt>
>
> Again, when parsing this abbreviation, vim will replace the <lt> by
> '<'. So you would need to enter <sg to trigger this abbreviation.
>
> Now you need to know, that there are three types of abbreviations, as
> detailed by :h abbreviations. You are abbreviation '<s' is of kind
> end-id. But, the abbreviation <sg is of neither type, so it is
> invalid.

For more info:

:help abbrev | /end-id

I still don't understand why things like 'a.b' and '#def' aren't
possible for abbreviations (anyone have a simple example of why that's
difficult to handle?), but probably more of a vim-dev question.

--
Best,
Ben

--
You received this message from the "vim_use" 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

No comments: