[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "man" command made easy? ->vim




"Actually, I'm not 100% sure that vim supports backreferences
like that (the \1 in the replacement text). I know that Python's and
Perl's regex engines do. I think I've heard/read that vim does do
backreferences."

Vim does support backreferences, "h: regex" will give more details.There was a recent talk on e-mail-list(http://groups.yahoo.com/group/vim/message/19141)
about the small diferences between perl regex and vim regex.



From: D-Man To: debian-user@lists.debian.org CC: Dave Sherohman Subject: Re: "man" command made easy? Date: Mon, 16 Jul 2001 23:02:31 -0400

On Mon, Jul 16, 2001 at 03:41:01PM -0700, Paul Mackinney wrote: | D-Man uttered: | > | > [I haven't been following most of this thread, but] | > | > On Mon, Jul 16, 2001 at 10:59:23AM -0700, Paul Mackinney wrote: | > | Night before last I ran 'find /usr/doc -name "index.html" >foo.txt' and | > | then spent 2 hours adding links from foo.txt to my local home/start | > | > 2 hours!? Wow. Learn vi(m) or some other advanced editor. If you | > have that foo.txt with each filename on its own line the following | > will take very little time to create a web page of links out of it. | | Vim is indeed my editor of choice. The 2 hours was mostly because I got | distracted reading & checking out the stuff I found. But my edits

Oh, ok. That's better. Two hours reading docs, not two hours creating HTML links.

(BTW, thanks guys for those other generation techniques)

| weren't nearly as slick as what you suggest. | | Thanks to a conversation at a BAD (Bay Area Debian) meeting last week, I | was clued in to visual mode. Here's what I did: | 1. At the first line, type 'v' to enter visual mode. | 2. Scroll to the last line, type ':' | 3. Vim starts the command text for you. Append | s/^/ DESCR <\/a>/g | | This turned a line like | /usr/share/doc/apache/manual/mod/index.html | | into | DESCR

Yes, visual mode is great when you want to operate on a subset of the buffer. The '%' at the beginning of my command means use the whole buffer.

| But your technique for capturing the original line & using it for the | link description is very cool & will save me much effort for my updates.

Thanks. Actually, I'm not 100% sure that vim supports backreferences like that (the \1 in the replacement text). I know that Python's and Perl's regex engines do. I think I've heard/read that vim does do backreferences.

BTW, I probably spent more time making my sample commands a little shorter than you spent with your slightly simpler version. Also, the simpler the command is the more likely it is correct ;-).

-D


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



Reply to: