------------------------------------------------------------------------------- VI for repetive tasks. VI is much better for repeative tasks, than EMacs or other window file editors. Under Xwindows I use a scrap pad postit note to create a set of commands (often substitutes) which I wish to perform over a lot of files.. I then VI all files to be edited, often including those whcih don't need editing (on one command line) and `insert' those VI commands into each file very quickly. To make it easier I define the following command to save the current file and go to the next file. (Add this you your ~/.exrc file) :map N :w^M:next^M NOTE: ^M in the above is a ctrl-M and is input by typing ctrl-V ctrl-M Thus to insert the stuff I type `paste' `N' `paste' `N' .... until I run out of files!!!! Very VERY fast. I have updated over a thousand files in this way in a matter of minutes, including any exceptions which may be present in the list!!!! Common tasks I save into other files for future use. See the file `uppercase_links' on the WWW floor for an example. ------------------------------------------------------------------------------- The EXINIT environment variable This environment variable overrides the use of .exrc files. It is a good idea to use this variable to stop `spoofing' of your vi editor. I myself use it to force the reading of my own vi macros regardless of how `dumb' a particular machine is. setenv EXINIT "source $(HOME)/.virc" ------------------------------------------------------------------------------- No Tabs in vi indentation Tell vi that tabs are huge and it will never add them (only using spaces) :set tabstop=1000 HOWEVER tabs will not be displayed correctly :-( This will set any tabs you create as a indent instead :map! ^I ^T You will still need to detab any loaded files however, and this is no good if you need to edit files whcih need tabs (like Makefiles) ------------------------------------------------------------------------------- Interactive search and replace It is builtin, just add the c flag to the substition command :range s/target/replacement/gc ------------------------------------------------------------------------------- Merge multiple blank lines :%!sed /./,/^$/!d ------------------------------------------------------------------------------- VI doesn't read my personal termcap entries. If this is the case then it is a sure bet that your VI uses TERMINFO for its terminal capabilities information. This is true for SunOS and SysV systems. To check type strings `which vi` | grep term If it gives strings about terminfo then that is what it uses. To solve download "captoinfo" from some archie and use it. To get the information from a terminfo database without the database source available use the system V command "infocmp" to dump the source for the current TERM. --- Terry Lambert <terry@icarus.weber.edu> -------------------------------------------------------------------------------