Posted by: rongshengfang | August 9, 2006

vi (not vim) automatic text formatting on Solaris

Automatic text formatting with vim (Vi IMproved) is easy and I really like that. But on most of the Solaris servers I manage, vim is not installed. So whenever I need to modify a file on a system, I have to constantly remind myself to insert a carriage return when the line has more than 72 characters. Actually I don’t have to anymore after I read this Sun INFODOC (you need to logon Sunsolve to read this doc).

Basically add the following line to ~/.exrc:

map ^V^X !}fmt ^M

Then when you edit a file with vi, type CRTL-x to format the current paragraph so every line has only 72 chars or less.

Learning new stuff everyday…


Leave a response

Your response:

Categories