blob: 69788760cc63af6fb9d87df3d43fc51e000f6a18 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Good old CFG files
3" Maintainer: Igor N. Prischepoff (igor@tyumbit.ru, pri_igor@mail.ru)
zeertzjq9c9200d2025-05-02 15:32:23 +02004" Last Change: 2012 Aug 11
Christian Brabandt7c3b65e2024-11-14 23:22:31 +01005" 2024 Nov 14 by Vim project: // only denotes a comment when starting a line (#16051)
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02007" quit when a syntax file was already loaded
8if exists ("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00009 finish
10endif
11
12" case off
13syn case ignore
14syn keyword CfgOnOff ON OFF YES NO TRUE FALSE contained
15syn match UncPath "\\\\\p*" contained
16"Dos Drive:\Path
17syn match CfgDirectory "[a-zA-Z]:\\\p*" contained
18"Parameters
Bram Moolenaar9b451252012-08-15 17:43:31 +020019syn match CfgParams ".\{0}="me=e-1 contains=CfgComment
Bram Moolenaar071d4272004-06-13 20:20:40 +000020"... and their values (don't want to highlight '=' sign)
21syn match CfgValues "=.*"hs=s+1 contains=CfgDirectory,UncPath,CfgComment,CfgString,CfgOnOff
22
23" Sections
24syn match CfgSection "\[.*\]"
25syn match CfgSection "{.*}"
26
27" String
28syn match CfgString "\".*\"" contained
29syn match CfgString "'.*'" contained
30
Christian Brabandt7c3b65e2024-11-14 23:22:31 +010031" Comments (Everything before '#' or ';' or leading '//')
Bram Moolenaar071d4272004-06-13 20:20:40 +000032syn match CfgComment "#.*"
33syn match CfgComment ";.*"
Christian Brabandt7c3b65e2024-11-14 23:22:31 +010034syn match CfgComment "^\s*\/\/.*"
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
Bram Moolenaar6c391a72021-09-09 21:55:11 +020036" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020037" Only when an item doesn't have highlighting yet
Bram Moolenaarf37506f2016-08-31 22:22:10 +020038hi def link CfgOnOff Label
Christian Brabandt7c3b65e2024-11-14 23:22:31 +010039hi def link CfgComment Comment
40hi def link CfgSection Type
41hi def link CfgString String
Bram Moolenaarf37506f2016-08-31 22:22:10 +020042hi def link CfgParams Keyword
43hi def link CfgValues Constant
44hi def link CfgDirectory Directory
45hi def link UncPath Directory
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020047
Bram Moolenaar071d4272004-06-13 20:20:40 +000048let b:current_syntax = "cfg"
49" vim:ts=8