------------------------------------------------------------------------------- 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 which 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 In VIM you can instead use... :map N :w<CR>:next<CR> Thus to insert the stuff I can {paste} N {paste} N .... where {paste} are VI command line key sequences, including ED (':...') commands. Using this I can edit vast numbers of files very VERY fast! It also means I can setup library (text files) of very complex VI commands for reformating text in various complex ways, to use when needed. ------------------------------------------------------------------------------- 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> -------------------------------------------------------------------------------