Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!pbox!romed!svo!okstate!gregg From: gregg@okstate.UUCP Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: vi tips- summary number one Message-ID: <2551@okstate.UUCP> Date: Fri, 11-Sep-87 11:43:04 EDT Article-I.D.: okstate.2551 Posted: Fri Sep 11 11:43:04 1987 Date-Received: Sun, 13-Sep-87 08:43:45 EDT References: <601@augusta.UUCP> Organization: Oklahoma State Univ., Stillwater Lines: 58 Xref: utgpu comp.unix.questions:3626 comp.unix.wizards:3926 in article <601@augusta.UUCP>, bs@augusta.UUCP (Burch Seymour) says: > > This is the first summary in response to my recent request for vi > tips. The response was really amazing. These are the short items. > Longer items will follow shortly in other articles > > ============================================================================== > Re-format text using the '!}fmt' command. This one will re-format a paragraph. > '!]]fmt' does the rest of the buffer. '!)fmt' does a sentence. > ------------ The ]] and [[ movements are actually 'end of section, and beginning of section respectively. If you are editing a C source file, [[ take you to the previous '{', at the beginning of the line, from your current location. If you write C normally, i.e. main (argc, argv) int argc; char **argv; { ... function body ... } then this is a great way to move to the top of a function as you are writing it to put in another declaration, as then '' gets you back to where you were working. ]] takes you to the NEXT function in a file containing C code. Also, fmt(1) is not available everywhere. nroff(1) is a good way to filter text in a file and reformat it. > 'd]]' deletes the rest of the buffer Again, depends on what type of text you are editing. dG is a better way to delete to the end of the file. > > The search operation may be used also: > > 'd/pattern' deletes up to the patern, but leaves the pattern. > > The neat thing about this principle is it works with most other vi commands > such as 'y' yank, and 'c' change. > ----------------------------------------------------------------------------- What most VI users fail to discover is that you can use the 'd', 'y', and 'c' commands to effect their purpose on any region that is delimited by moving the cursor with the following keystrokes. 'x' is just 'dl', 'X' is just 'dh', 's' is 'cl', 'C' is 'c$', 'D' is 'd$' and 'S' is 'cc' (which makes absolutly no sense). All you have to do is learn the movements, and then you know how to yank/delete/change whatever region of text you desire. ----- Gregg Wonderly Department of Computing and Information Sciences Oklahoma State University UUCP: {cbosgd, ihnp4, rutgers, seismo, uiucdcs}!okstate!gregg ARPA: gregg@A.CS.OKSTATE.EDU