Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Good old CFG files |
| 3 | " Maintainer: Igor N. Prischepoff (igor@tyumbit.ru, pri_igor@mail.ru) |
zeertzjq | 9c9200d | 2025-05-02 15:32:23 +0200 | [diff] [blame] | 4 | " Last Change: 2012 Aug 11 |
Christian Brabandt | 7c3b65e | 2024-11-14 23:22:31 +0100 | [diff] [blame] | 5 | " 2024 Nov 14 by Vim project: // only denotes a comment when starting a line (#16051) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 7 | " quit when a syntax file was already loaded |
| 8 | if exists ("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | finish |
| 10 | endif |
| 11 | |
| 12 | " case off |
| 13 | syn case ignore |
| 14 | syn keyword CfgOnOff ON OFF YES NO TRUE FALSE contained |
| 15 | syn match UncPath "\\\\\p*" contained |
| 16 | "Dos Drive:\Path |
| 17 | syn match CfgDirectory "[a-zA-Z]:\\\p*" contained |
| 18 | "Parameters |
Bram Moolenaar | 9b45125 | 2012-08-15 17:43:31 +0200 | [diff] [blame] | 19 | syn match CfgParams ".\{0}="me=e-1 contains=CfgComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 20 | "... and their values (don't want to highlight '=' sign) |
| 21 | syn match CfgValues "=.*"hs=s+1 contains=CfgDirectory,UncPath,CfgComment,CfgString,CfgOnOff |
| 22 | |
| 23 | " Sections |
| 24 | syn match CfgSection "\[.*\]" |
| 25 | syn match CfgSection "{.*}" |
| 26 | |
| 27 | " String |
| 28 | syn match CfgString "\".*\"" contained |
| 29 | syn match CfgString "'.*'" contained |
| 30 | |
Christian Brabandt | 7c3b65e | 2024-11-14 23:22:31 +0100 | [diff] [blame] | 31 | " Comments (Everything before '#' or ';' or leading '//') |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | syn match CfgComment "#.*" |
| 33 | syn match CfgComment ";.*" |
Christian Brabandt | 7c3b65e | 2024-11-14 23:22:31 +0100 | [diff] [blame] | 34 | syn match CfgComment "^\s*\/\/.*" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 35 | |
Bram Moolenaar | 6c391a7 | 2021-09-09 21:55:11 +0200 | [diff] [blame] | 36 | " Define the default highlighting. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 37 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 38 | hi def link CfgOnOff Label |
Christian Brabandt | 7c3b65e | 2024-11-14 23:22:31 +0100 | [diff] [blame] | 39 | hi def link CfgComment Comment |
| 40 | hi def link CfgSection Type |
| 41 | hi def link CfgString String |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 42 | hi def link CfgParams Keyword |
| 43 | hi def link CfgValues Constant |
| 44 | hi def link CfgDirectory Directory |
| 45 | hi def link UncPath Directory |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 46 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 47 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 48 | let b:current_syntax = "cfg" |
| 49 | " vim:ts=8 |