分类: LINUX
2011-06-14 00:04:26
Configuring vi
When we first started talking about vi, I mentioned that there were a lot things we could do to configure it. There are mappings and abbreviations and settings that we can control. The problem is that once we leave vi, everything we added is lost. Fortunately, there is hope. Like many programs, vi has its own configuration file: .exrc (note the dot at the front). Typically, vi just uses its standard settings and does not create this file. However, if this file resides in our home directory, it will be valid every time we start vi unless we have an .exrc file in our current directory which will then take precedence. Having multiple .exrc files is useful when doing programming as well as when editing text. When writing text, I don't need line numbers or autoindent like I do when programming. The content and syntax of the lines is exactly the same as in vi; however, we don't have the leading colon. Part of the .exrc file in my editing directory looks like this:map! ^X :wq
map x :wq
map! ^W :w
map w :w
set showmode
set wm=3
abbr Unix UNIX
abbr btwn between
abbr teh the
abbr refered referred
abbr waht what
abbr Para {P}
abbr inot into