Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: One user's editor wish list Message-ID: <1991Mar13.231702.8498@convex.com> Date: 13 Mar 91 23:17:02 GMT References: <1991Mar12.190344.7863@ecf.utoronto.ca> <755@amsaa-cleo.brl.mil> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: na Organization: CONVEX Software Development, Richardson, TX Lines: 48 Nntp-Posting-Host: pixel.convex.com From the keyboard of mcohen@amsaa-cleo.brl.mil (Marty Cohen): :Many of us are daily users of vi, but still aren't comfortable :enough to use features like multifile editing. Would some expert :please give a short example of editing three files and moving text :from one to another? You use the named buffers. There are a-z; use "a to access them for use with the yank, put, and delete commands. Capital letters append to the buffers, lower-case will overwrite. Let's say we want to edit the files foo, bar, and baz. Do this: $ vi foo bar baz /some_string # find some string "ad) # delete next sentence into named buffer a :n +/ # go on to next file. assume autowrite set; start at some_string (i have ^N bound to this) {"Ay2} # back up previous paragraph, yank next 2 paragraphs into named buffer a, appending to what was there /other_string # find something else "bdG # delete from there to bottom of file into named buffer b :n # go to next file /omega # find a string "aP # insert things from named buffer a before cursor position. G"bp # go to bottom of file, put what's in named buffer b after cursor :rew # go back to first file and iterate until happy Note that your named buffers, including the numeric ones, stick around between files, but the unnamed buffer gets trashed. The numeric buffers are your delete stack. "3p will put the third- to-the-last thing back. The dot command is special for numeric buffer references: it autoincrements them. This allows you to run backwards through your delete stack by just hitting a dot. For example, this will reverse a list of 6 lines in your file: dd # delete this line ..... # repeat 5 times k"1p # go up and put back last line deleted ..... # repeat with autoincrement, reversing lines --tom