[Vimperator] abbreviation (patch) [+RFC: text substitution]

Doug Kearns dougkearns at gmail.com
Sun Nov 4 03:08:49 PST 2007


On 11/4/07, Martin Stubenschrott <stubenschrott at gmx.net> wrote:
> On Sat, Nov 03, 2007 at 06:34:48PM +1100, Doug Kearns wrote:

<snip>

> > > :echo "Vimperator version is: #{v:version}" -> Access any vimperator variable
>
> You didn't comment on that.

I did with,

:echo "Vimperator version is: " . v:version

<snip>

> > :imap MS<space> Martin  Stubenschrott<Esc>Bhi " assuming you want it
> > triggered by the trailing space
>
> 1.) :imap != :abbr

Well no, but they're usually the way I do this sort of thing in you know
what.  These discussions don't seem very circular at all. ;-)

> 2.) vim understands <up><down> in :abbr, but it's still annoying to use
> for such use cases.

In this example, at least, it's easy enough to do:

:abbr MS Martin Stubenshrott<S-Left><Left>

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

:iabbrev <expr> DATE "Today is: " . vimperator.system('date')

<snip>

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

Well I've always thought of %, #, <foo> as 'reserved' but unimplemented.
:)

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

:echo "#" works fine. There's no need to escape it, only a bare # is
expanded.

> > <clink> could be the current 'link' like <cword>
>
> Same problematic use of </> which will be input/output redirection.

I don't see a problem here at all - just an implementation detail at
worst.

<snip>

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

Again I don't see that as a problem but I'm not really convinced by
<text> either.  I think it would be better implemented as filtering
with !

<snip>

> > A separate :dump command would be useful too.
>
> I am rather for extending :saveas -type text|full|whatever [filename]
> than making a new command.

Sure.

Doug


More information about the Vimperator mailing list