[Vimperator] abbreviation (patch) [+RFC: text substitution]
Doug Kearns
dougkearns at gmail.com
Sat Nov 3 00:34:48 PDT 2007
On 11/3/07, Martin Stubenschrott <stubenschrott at gmx.net> wrote:
<snip>
> A different question, how to best implement text substitution?
> Requirements are, that it should be somehow generic, and not just needed
> for abbreviations.
>
> My proposed idea is taken from ruby syntax, and i have these idea, but
> am not sure if it is the best way:
Well you won't be surprised to hear my preference is that it be done "the Vim
way" whenever possible.
> :echo "Vimperator version is: #{v:version}" -> Access any vimperator variable
:echo "Vimperator version is: " . v:version
> :abbr MS Martin #{cursor} Stubenschrott -> (would place the cursor to
> #{cursor} after expanding)
:imap MS<space> Martin Stubenschrott<Esc>Bhi " assuming you want it
triggered by the trailing space
This would require some INSERT mode improvements obviously.
> :iabbr DATE #{`date`} -> run shell commands and get its output
:iabbr <expr> DATE vimperator.system('date')
> Most of these commands are written just once anyway, and the slightly
> verbose syntax doesn't matter. For interaction with :! this might
> however be different, what would work well, is that:
> f to show hints
> :!wget #{12} #{15} #{22} -> downloads these 3 links
:!wget @12 @15 @22
Where @ is probably whatever you like other than % or #. The # has meaning in
Vim, alternate buffer, which would be nice to support.
<clink> could be the current 'link' like <cword>
> And download the current file, one would need
> :!wget #{url}
:!wget %
> To grep the current textContent of the website:
> :!grep foo #{text}
:!grep foo <text>
I assume you mean the text is written out to a tmp file and then passed to the
external command?
A separate :dump command would be useful too.
<snip>
Doug
More information about the Vimperator
mailing list