|
From: | Thomas Dickey |
Subject: | Re: [vile] Limitations of :g commands |
Date: | Wed, 10 May 2006 16:21:50 -0400 (EDT) |
On Wed, 10 May 2006, Paul Fox wrote:
decklin wrote: > Today (okay, so I only installed vile yesterday) I found myself needing > to do something with every other line in a file. In vi, the rhs of :g > is just an ex command, so this can be done in a not-very-pretty way by > specifiying a relative range, like > > :g/^/+d
...
> Sorry if this has been asked before; all I could find were the new > list's archives. i don't recall this coming up before.
Perhaps not on the mailing list, but I recall the general topic coming up. It's doable, but not trivial. The problem is that vile's splitting the command-parsing into parts and has only a simple parser for the command at the point where it encounters the "+d". The "+" is part of an address expression and vile's expecting only a verb.
What makes it nontrivial to implement is how to handle line-editing (and the corresponding command-history), since addresses are parsed in one place and verbs in another. The execute_named_command() function in exec.c does something like that (and it took quite a while to debug).
Perhaps it would be possible to make that function reentrant, so it could be used to process arbitrary ex-commands...
-- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
[Prev in Thread] | Current Thread | [Next in Thread] |