On Mon, 4 Jun 2007 at 11:27am, Gene Kwiecinski wrote: > Just getting to email now, so this is essentially a consolidated reply > to all who answered... > > >>> Speaking of which, is there any quicker way to visually select the >>> entire file, analogous to ^A in other systems? > >> To copy the entire file to the system clipboard, you can do: >> :%y+ >> Rpelace y with d if you want to cut instead of copy. >> Replace + with * if you want to use middle-click to paste (on X11.) > > That's about the shortest I could come up with, ":%d+", to do what I > want, but still not quite what I was looking for. I was kindasorta > expecting a normal-mode solution, like 'gg*V' or something, to avoid > even toggling the shift key all that much (think "baud" vs "bps"). > > The only thing I really use it for is to c&p from LookOut's email to > 'vim', then back again. So I ^A the entire reply, dump it into a new > 'vim' window, edit it to insert a new quotelevel, etc., then want to > "^A" it to get it back into LO. But it's repetitive/frequent enough to > make me want to shorten the command further. > > Ain't "hung up" on visual mode or anything (hi Tim!), it's just that > when I don't want headers at the top, I can start from the bottom ('G'), > make my way to the top in visual ('1G'), then down my way past the > headers to *not* grab them when putting it all back. Or v/v if I want > to skip the signature. Etc. > > The 'vim' instance used to do the editing is going to disappear > immediately after, so I'm not concerned about cut vs copy, etc. > Everything goes into the "clipboard", then dumped back into LO's reply > window, so a plain ':%d' won't work. > > > In a similar vein, I was never much on "visual" vs *real* 'vi' commands, > but it does come in handy to delete subroutines, etc. Eg, for the > format > > sub sub1(){ > ... > } > > sub sub2(){ > ... > } > > all you need to do it find the initial "sub", then "V$%jj" to grab the > whole thing, and delete it, copy it, cut it, etc. Go into visual, > end-of-line (for the leading '{'), '%' (for the matching '}'), down a > coupla lines to grab trailing whitespace, then bam!, it's gone. And > it's a visual confirmation to make sure you don't go nuts and delete > more than you intended. > > Point being that for some operations, visual mode is a lot more > reassuring.
Have you looked at the below Vim tip? http://www.vim.org/tips/tip.php?tip_id=805 Read through the comments as well as the original tip has been improved over a few iterations in the comments. -- Hari ____________________________________________________________________________________Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. http://tv.yahoo.com/