Thursday, January 7, 2010

Re: how to abbreviate multiple words

Am 06.01.2010 18:03, schrieb Brian Golding:
> Is it possible to abbreviate multiple words. For example to enter a
> command such as
>
> ab "by using" using
>
> so that anytime the words "by using" are entered, they will be
> replaced by just "using"?
>
> Thanks
> Brian Golding

You can check out Kana's ctxabbr plugin (actually an autoload script):
http://vim.sf.net/scripts/script.php?script_id=2514

The script serves a slightly different purpose, but the following works
for me:

:call ctxabbr#define('using', "\<C-W>using", '<by')

This defines a "context sensitive" abbreviation. It works like

:inoreabbrev using <C-W>using

but expands only when "by" is found to the left.

--
Andy

No comments: