Changing the background color at 80 columns in vi


My friend Taylor Gresser showed me this one. Putting the following into ~/.vimrc will cause the background color to change once the cursor moves past 80 columns.

highlight variable ctermbg=darkred ctermfg=white
match variable /\%81v.\+/

Why would this be useful? I regularly create text files that are displayed on the console. This allows me to easily see when I've gone over 80 characters on a line, which wouldn't display correctly on the console. Handy.

11/08/2010