http://www.vim.org). It’s got all the features of vi and more. One powerful feature is called syntax highlighting; it helps immensely when programming because it provides additional visual clues when editing source code.
If you fall on the vi side of the “Great Editor Debate,” then hopefully you’re using vim (http://www.vim.org). It’s got all the features of vi and more. One powerful feature is called syntax highlighting; it helps immensely when programming because it provides additional visual clues when editing source code.
If you fall on the vi side of the “Great Editor Debate,” then hopefully you’re using vim (http://www.vim.org). It’s got all the features of vi and more. One powerful feature is called syntax highlighting; it helps immensely when programming because it provides additional visual clues when editing source code.
However, if you turn on syntax highlighting (by using syntax on in your local .vimrc file) and then attempt to view code that contains a mix of Scheme and Perl (as outlined in last month’s column), you’ll probably see something like what is shown in Figure One.
Figure One: Viewing a mix of Scheme and Perl in vim.
Because vim doesn’t know that everything within a pair of curly braces is Perl code, it highlights that section in red as if there were a syntax error. Vim can highlight either Scheme or Perl on an individual basis, but it can’t do both of them simultaneously. Not yet, anyway.
The Structure and Interpretation of Syntax Highlighting Files
Vim uses syntax highlighting files to control how the text from the file being edited should be displayed. The file name or suffix generally determines which highlighting file to use.
These syntax-highlighting files are usually composed of two major sections. In the first, syntax…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: