there's a reason your cellphone works, we can get IRC in half our deserts,
and ships actually get to where they're going while carrying the trade goods
of all nations.
Politics aside, it's a smaller world than we think. We could use a few more
of them, but so far, it's the only one we've got. Sharing's a good thing -
and the typical open sorceror knows this without thinking about it. I'm glad
we've a few juicy threads to share with you this month. Enjoy!
____________________________________________________
(?) Automatically selecting matched lines.
From Thomas Adam
Answered By: Tim Chase
This is a question that I posted to the Vim mailing-list. Tim Chase was
kind enough to reply, and in some detail, so it ends up here. Thanks,
Tim! :) -- Thomas Adam
Hello, all -
I'm trying to get Vim to automatically select (hilight) lines in a file that
start with a particular phrase. Basically, I want it then to run a command
over the selected text. Doing this manually is not a problem, but I am
having a lot of trouble trying to automate it.
I was under the impression that "V%" is what I was after, yet each time I
try it, Vim responds with: "V% is not an editor command". I'm overlooking
something, but what?
(!) [Tim] I don't think Vim supports disjoint selecting like what I
understand you want to do...in a single pass. However, each disjoint piece
can be passed to your external program if you want. Perhaps something
like:
:g/^\s*\n>/+,/^>\@!/-1! extern_command
Broken down, that's:
:g on every line that matches
^\s*\n> an empty line followed by a ">" on the next line
+ begin a range on the next line (the one with the ">")
, through
/^>\@!/ the next line that doesn't begin with a ">"
-1 adjust the 2nd range argument to be the previous line
because the previous search found the next line that
doesn't have a leading ">" so we have to backup a line
! pass the contents of the range through
external_command and replace the original contents with the
output of "external_command"
Thus, if you wanted to make your quotations in the mail-file all
sound like B1FF (assuming you have the bsd-games collection
installed), you could do
:g/^\s*\n>/+,/^>\@!/-1! b1ff
Any Ex command can take the place of "! b1ff" there, so if you just want
to do normal Vi/Ex commands instead, they all work. If you want to indent
those ranges one shift-width, you can do
:g/^\s*\n>/+,/^>\@!/-1>
Or if you want to delete all quotations, you can do
:g/^\s*\n>/+,/^>\@!/-1d
You can even selectively search and replace only in quotations with
something like
:g/^\s*\n>/+,/^>\@!/-1 s/foo/bar/g
All sorts of handy combinations of things.
Or maybe I didn't understand your original post correctly, and all this is
just a pedantic exercise in the joy of Ex ;)
____________________________________________________
(?) Exim with Dynamic IP - 2 Questions
From Balbir Thomas
Answered By: Neil Youngman
Dear Answer Gang,
I am using exim to deliver mail form my local host. I have a dynamic IP
address and am using zoneedit as my dns server. So mail to my
userID@my.domain is delivered straight to me. However I have trouble
sending mail to certain address as their ISPs/Postmasters have decided to
block emails originating from dynamic IP address to reduce spam. For
example AOL. I would be greatfull if you could suggest means to solve this
problem, short of paying for a static IP (which I don't need but for this
reason). Talking to my ISP (RoadRunner) has been a waste of time.
=7= |