Vi Hacks

vi is not for the weak. For those who choose to use its awesome power, it brings quick, powerful editing on every unix platform. And if you are stuck on emacs for some bizarre reason (I like colors for my code too), try a meta-X vip-mode sometime...vim5 has a nice GUI; there is no more need for emacs.

This is basically all of my .exrc' be explained later.

set terse rocks my world. If you already know vi (and you may well if you are reading this page) doing a set terse makes vi ever more true to its nature. If you are running the emulated vi in linux you need to add set compatible to start yourself on the road to true vi. If you can't tell, I'm not a big vim fan. I can do just about everything I need in plain vi without getting dependent on fancy features in a non-standard program.

I have begun researching different vi's and I was using nvi for a little while because it fixes a security hole I found in other versions of vi. A friend of mine, Dave Powell, wrote a little LD_PRELOAD hack around this hole, but I haven't started using it yet. I'm also not sure I like the potential spare features of nvi. Feel free to check out the nvi home page.

My search for purity and security ended when I found /usr/xpg4/bin/vi under Solaris. It follows the POSIX standard on loading up the .exrc file (the source of the security hole) and will not load that which you do not own.

Some .exrc foolery

set exrc
set wm=8
map ^X !}fmt ^M
(if your fmt supports -c) map ^X !}fmt -c ^M
map = :!cp % .spelltemp^M:w^M:!ispell %^M:e!^M:!cp .spelltemp %^M
map ^B !}jive
map q :.,$s/^/>/^M:%s/>$//^M''
set terse

You do need to put the ^M's and such into the file by hand...they are not encoded on the page because they did not show up as themselves.