[Linux-disciples] vim: selecting lines matching a pattern
Adam Rosi-Kessel
adam at rosi-kessel.org
Thu Dec 22 15:28:47 EST 2005
Stephen R Laniel wrote:
> On Thu, Dec 22, 2005 at 03:22:22PM -0500, Adam Rosi-Kessel wrote:
>> I always forget sed syntax, but there is a way to specify a range based on
>> regexps, and then specify an operation on that range, which I believe could
>> include a 'join' type operation. I'd have to muck around in the sed manpage
>> for a while to get the syntax right, though.
> I've basically always thought that sed and vim had identical
> search-and-replace syntax, such that if it were possible in
> vim it would be possible in sed.
> There's probably a way to do it in Perl as well. I mean, I
> could fake something involving the '..' operator ...
It's certainly do-able in vim. It would just be a sort of hack, at least the
way I would do it. Something like:
:map __1 /<p><cr>V/<\/p><cr>Jj__1
:map _1 gg_1
This would cause _1 to map to the action of doing what you desire.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20051222/94cab457/signature-0001.pgp
More information about the Linux-disciples
mailing list