Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: vi for power users Message-ID: <110178@convex.convex.com> Date: 10 Dec 90 16:42:28 GMT References: <1990Dec08.200418.6663@chinet.chi.il.us> <110093@convex.convex.com> <1990Dec10.051430.12025@chinet.chi.il.us> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 51 In article <1990Dec10.051430.12025@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >If you don't build it in, you are going to have a heck of a time figuring >out the piece you want to manipulate in the other tool. I will stifle my urge to preach much on tool philosophy again. If you won't learn tools, you cripple yourself. Like using cc without lint. :>The very *VERY* few times I've wanted to do something not on :>the same line, it takes me maybe 15 seconds of programming in sed, cut, :>awk, or perl does the trick. Show me the kind of problem you mean. : :It's a situation you would see in secretarial work more than programming. :You have something typed in with nice alligned columns and at the last :minute you decide to move one of the columns. Happens all the time. :In practice, I don't need this a lot myself but it is a very good reason :not to recommend vi for secretarial use. "Very good" may be too strong. If you can't teach your secretary the following awkly method, you should consider replacing him with someone more trainable, since I wonder what else they can't learn either. I know, it sounds condescending again. The truth is, I've never once met a secretary whom I couldn't teach this stuff to, and I have taught a good number in my day. Now it's true that the regexp to do this is a bit awkward in vi. That's why I generally prefer to type them in on a text line first, then suck them into a buffer and execute them. :s/foo/bar/ "mdd@m and then if I don't like it, I "mP it and fix. If I do, :%& works. But that awkward part should be a hint. Use awk. You really shouldn't try too hard for nicely aligned columns in vi anyway; for this, they invented tbl. To switch columns 4 and 5 around, this is easier than the regexp in vi to do it: 1,10!awk 'print $1, $2, $3, $5, $4, $6' or using tabs because you're going to tbl it: 1,10!awk -F 'print $1, $2, $3, $5, $4, $6' I'll bet your secretaries could handle this. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me