4.9 Setting Up vi with the .exrc FileYou can store commands and settings that you want executed any time you start the vi or ex editors (30.2 ) in a file called .exrc in your home directory. You can modify the .exrc file with the vi editor, just as you can any other text file. If you don't yet have an .exrc file, simply use vi to create one. Enter into this file the set , ab (30.31 ) , and map (31.2 ) commands that you want to have in effect whenever you use vi or ex . A sample .exrc file looks like this: set nowrapscan wrapmargin=7 set sections=SeAhBhChDh nomesg map q :w^M:n^M " To swap two words, put cursor at start of first word and type v: map v dwElp ab ORA O'Reilly & Associates, Inc.
The In addition to reading the .exrc file in your home directory, vi will read a file called .exrc in the current directory. This allows you to set options that are appropriateto a particular project . (30.6 ) If your .exrc file doesn't seem to be working, watch carefully for error messages just as vi starts, before it clears your screen. If you can't read them quickly enough, start ex instead of vi . The q! command quits ex : % The tricks in article 42.8 may also be useful. - from O'Reilly & Associates' Learning the vi Editor , Chapter 7 |
|