home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 30.20 Multiple Editor Setup Files; Starting with a Search Chapter 30
vi Tips and Tricks
Next: 30.22 Filtering Text Through a UNIX Command
 

30.21 Per File Setups in Separate Files

Do you need to set certain editor options for certain files - but not use the same setup for every file you edit? Make a special setup file with the same name and an underscore (  _  ) at the end. For instance, a file named report could have a corresponding setup file named report_ . (You don't have to use an underscore at the end of the filename. It's convenient though, because it's not a shell special character ( 8.19 ) .)

The setup file has the same format as a .exrc file ( 30.6 ) . To make the editor read it, map ( 31.2 ) a function key like F1 (or any other key sequence):



source
 
^[
 

map #1 :source %_^[

When you start vi , tap that key to read the setup file. (The percent sign stands for the current filename ( 30.4 ) .)

If you want to use the same setup file for several files in a directory, you might want to make hard links ( 18.4 ) between them. That will save disk space. It also means that if you decide to change a setup option, you can edit one of the links to the setup file and the others will have the same change.

- JP


Previous: 30.20 Multiple Editor Setup Files; Starting with a Search UNIX Power Tools Next: 30.22 Filtering Text Through a UNIX Command
30.20 Multiple Editor Setup Files; Starting with a Search Book Index 30.22 Filtering Text Through a UNIX Command

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System