VI Editor 6'th Edition

Page 218

command to see the error messages, and the :cnext command to move to the next error.

11.9.2 Syntax Highlighting Highlighting in vim is based primarily on colors. To enable syntax highlighting, put syntax on into your .vimrc file. This will cause vim to read the syntax.vim file, which defines the default highlight coloring and then sets things up to use highlighting appropriate to each language. vim has a very powerful sub-language for defining syntax highlighting. The syntax.txt help file in vim 5.1 that describes it is over 1,500 lines long. Therefore, we won't attempt to give all the details here. Instead, the sample file below should give you some taste for what vim can do. The example consists of portions of the syntax file for Awk: " " " "

Vim syntax file Language: awk, nawk, gawk, mawk Maintainer: Antonio Colombo <antonio.colombo@jrc.org> Last change: 1997 November 29

" Remove any old syntax stuff hanging around syn clear " A bunch of useful Awk keywords syn keyword awkStatement break continue delete exit ... syn keyword awkFunction \ ...

atan2 close cos exp int log rand sin sqrt srand

syn keyword awkConditional syn keyword awkRepeat

if else while for do

syn keyword awkPatterns syn keyword awkVariables ...

BEGIN END ARGC ARGV FILENAME FNR FS NF NR

" Octal format character. syn match awkSpecialCharacter contained "\\[0-7]\{1,3\}" " Hex format character. syn match awkSpecialCharacter contained "\\x[0-9A-Fa-f]\+" syn match

awkFieldVars

syn syn syn syn ...

awkCharClass contained "\[:[^:\]]*:\]" awkRegExp contained "/\^"ms=s+1 awkRegExp contained "\$/"me=e-1 awkRegExp contained "[?.*{}|+]"

match match match match

"\$[0-9]\+"

" Numbers, allowing signs (both -, and +) " Integer number. syn match awkNumber "[+-]\=\<[0-9]\+\>" " Floating point number. syn match awkFloat "[+-]\=\<[0-9]\+\.[0-9]+\>" ...


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.