Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!bbn!oberon!cit-vax!ucla-cs!zen!ucbvax!sdcsvax!ucsdhub!esosun!seismo!uunet!munnari!otc!metro!physiol!daved From: daved@physiol.UUCP Newsgroups: comp.unix.wizards Subject: Re: vi tips- summary number one Message-ID: <86@physiol.su.oz> Date: Wed, 30-Sep-87 04:26:24 EDT Article-I.D.: physiol.86 Posted: Wed Sep 30 04:26:24 1987 Date-Received: Fri, 2-Oct-87 06:49:38 EDT References: <601@augusta.UUCP> <8524@mimsy.UUCP> <2280@sphinx.uchicago.edu> Organization: Physiology Dept., Univ. of Sydney, NSW, Australia Lines: 22 Keywords: vi tips, summary, good stuff, help with vi Summary: error In article <2280@sphinx.uchicago.edu>, d757@sphinx.uchicago.edu (Lawrence Lerner) writes: > Here is a quickie vi ref card for those that don't have acces to one. > > !! place results of command into file i.e. !!cat it.p will place > the list of it.p in your file. > This isn't quite right. '!' is a command which, in common with 'd', 'c' and 'y' can be followed by a cursor motion command. The text referred to is piped to the standard input of the command and the command's output will replace said text. In common with 'c', 'd' and 'y', '!' can be stuttered in which case the text referred to is the line containing the cursor. Thus "!!cat it.p" will pipe the current line to cat, which because it is given an argument will ignore the standard input, and the contents of the named file (if it exists) will REPLACE the current line. Thus "!!wc -c" will replace the current line with its character count. The '!' command is a powerful one. Its use in reformatting parts of text files was described in the original tips article. It can be used similarly on C source files with a C formatter such as cb. It's not an effective alternative to ":r file" unless you are purposely trying to clobber some text at the same time.