[Vimperator] abbreviation (patch) [+RFC: text substitution]
Martin Stubenschrott
stubenschrott at gmx.net
Sat Nov 3 07:46:46 PDT 2007
On Sat, Nov 03, 2007 at 06:34:48PM +1100, Doug Kearns wrote:
> Well you won't be surprised to hear my preference is that it be done "the Vim
> way" whenever possible.
Yes, I knew that ;)
> > :echo "Vimperator version is: #{v:version}" -> Access any vimperator variable
You didn't comment on that.
> > :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
1.) :imap != :abbr
2.) vim understands <up><down> in :abbr, but it's still annoying to use
for such use cases.
> > :iabbr DATE #{`date`} -> run shell commands and get its output
>
> :iabbr <expr> DATE vimperator.system('date')
Hmm, how does that work _easily_ with:
:iabbr DATE Today is: #{`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
Sounds ok for this specific usecase, but in your examples, more and more
keywords became reserved characters which you would need to take car of
in escaping.
> Where @ is probably whatever you like other than % or #. The # has meaning in
> Vim, alternate buffer, which would be nice to support.
"My" way of specifying substititutions has the advantage, that you can
write :echo "#" or _maybe_ (maybe as it's ruby incompatible) even :echo
"#{blabla" withouth needing to escape the #. So a :buffer # could still
be easily implemented by the :buffer command itself
> <clink> could be the current 'link' like <cword>
Same problematic use of </> which will be input/output redirection.
> > And download the current file, one would need
> > :!wget #{url}
>
> :!wget %
Hmm, that sounds nice for this specific usecase.
> > To grep the current textContent of the website:
> > :!grep foo #{text}
>
> :!grep foo <text>
< is bad, since we want to have input redirection at some time.
> I assume you mean the text is written out to a tmp file and then passed to the
> external command?
Hmm, right, but with input redirection probably:
:!grep foo < #{text}
makes more sense, but well, that's for later.
> A separate :dump command would be useful too.
I am rather for extending :saveas -type text|full|whatever [filename]
than making a new command.
--
Martin
PS: I don't think i'll have time for that anyway before i get hints into
a polished state, but that's probably the next project, i'll start after
the hints.
More information about the Vimperator
mailing list