Sunday, December 25, 2011

Re: Abbreviations that depend on the following character

On 26/12/11 06:46, Andre Majorel wrote:
> It would be nice to be able to type, say "l bon grain" for "le
> bon grain" and yet type "l'ivraie" without having it expand to
> "le'ivraie".
>
> A non-id abbreviation for "l'" like
> :inoreab l le
> :inoreab l' l'
> doesn't work. Not after white space anyway. (Even though the doc
> says "in front of the match is a space, tab or the start of the
> line or the insertion".)
>
> A mapping for "l'"
> :inoreab l le
> :inoremap l' l'
> seems to work, as long as you type fast enough.
>
> Is there a way that doesn't require two abbreviations/mappings ?
> Like a notional "inoreab l [^'] le" ?
>
> Thanks in advance.
>

Untested:

:inoreab <expr> l v:char == ' ' ? 'le' : 'l'

Of course you couldn't then type "l bonne avoine" for "la bonne avoine".
Vim doesn't (yet ;-) ) know anything about grammatical gender.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
255. You work for a newspaper and your editor asks you to write an
article about Internet addiction...in the "first person."

--
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: