Useful Controls for the Vi Text Editor

In this lab we use several highly useful controls for the vi text editor. These controls are to be kept in your ~/.exrc file. The .exrc file contains:
set shell=/bin/csh redraw
map K !} fmt -78 -c^M
map U !} fmt -50 -c^M}
map q K}
map E 20^E
map F :r ~/script/fast^M
map Y 20^Y
map Z :r ~/misc/add/single^M
map X :r ~/.sig^M
map Q :r ~/misc/bar^M
map W :r ~/misc/barshort^M
map z !} sed -f ~/script/bar.sed^M
map B !} sed -f ~/script/percent.sed^M
map ^C !} sed -f ~/script/bar.sed.rn^M
map ^X :1,$s/^/^V| /^M
map * !} centerscript^M
map = :r ~/misc/add/www^M
map , :w^M
map g 1G
You cannot cut and paste this version because I have modified it for clarity. I changed the control-M characters into the two characters '^M'. You cannot insert a control-M directly into a file using vi because it is a carriage return. To prevent this one types control-v first: '^V^M'. I have put a copy at dot.exrc.

NOTE: I tried to use characters that do not override important vi commands, but it might be that these had meanings that I was not aware of. If you modify your .exrc, beware of this.




Schneider Lab

origin: 2002 March 15
updated: 2002 March 15