[lug] vi question

B O'Fallon bof at americanisp.net
Fri Jan 19 15:55:37 MST 2001


Steven wrote:

> Can one get syntax highlighting with this editor?

Type :help to see the options available and how to set them.

I have found that the color syntax works with Slackware and Suse, but not for RedHat
6.1 - 7.0, which gave me "feature not implemented" error messages.

The way around this is to go to the vim page (http://www.vim.org/) and and follow
the links to download (either binaries or source) and install it. This also allows
use of a later version than is packaged with a distribution. (The latest version is
5.7.022).

There's also a HOWTO for the GUI version at:
http://www.linuxdoc.org/HOWTO/Vim-HOWTO.html

On the Vim home page are samples of various .vimrc files to place in one's /home
directory to automate configuration when it loads. I use this as mine:

     set nocp incsearch
     set cinoptions=:0,p0,t0
     set cinwords=if,else,while,do,for,switch,case
     set formatoptions=tcqr
     set cindent
     syntax on
     set showmatch
     set showmode
     set ruler
     set shiftwidth=4
     set tabstop=4

This gives a nice C language editor. The nocp options turns off strict vi
compatibility. The incsearch options turns on incremental searching. The other
options set up a K&R C style editor. The syntax on turns color syntax. Showmode
shows the editing/command mode at the bottom of the screen, showmatch shows
unmatched "(", and "{" symbols and the ruler shows the line and column number.

B. O'Fallon






More information about the LUG mailing list