Colin Caine | 4b3fab1 | 2024-04-18 23:53:02 +0200 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: OpenWrt Unified Configuration Interface |
| 3 | " Maintainer: Colin Caine <complaints@cmcaine.co.uk> |
| 4 | " Upstream: https://github.com/cmcaine/vim-uci |
| 5 | " Last Change: 2021 Sep 19 |
| 6 | " |
| 7 | " For more information on uci, see https://openwrt.org/docs/guide-user/base-system/uci |
| 8 | |
| 9 | if exists("b:current_syntax") |
| 10 | finish |
| 11 | endif |
| 12 | |
| 13 | " Fancy zero-width non-capturing look-behind to see what the last word was. |
| 14 | " Would be really nice if there was some less obscure or more efficient way to |
| 15 | " do this. |
| 16 | syntax match uciOptionName '\%(\%(option\|list\)\s\+\)\@<=\S*' |
| 17 | syntax match uciConfigName '\%(\%(package\|config\)\s\+\)\@<=\S*' |
| 18 | syntax keyword uciConfigDec package config nextgroup=uciConfigName skipwhite |
| 19 | syntax keyword uciOptionType option list nextgroup=uciOptionName skipwhite |
| 20 | |
| 21 | " Standard matches. |
| 22 | syntax match uciComment "#.*$" |
| 23 | syntax region uciString start=+"+ end=+"+ skip=+\\"+ |
| 24 | syntax region uciString start=+'+ end=+'+ skip=+\\'+ |
| 25 | |
| 26 | highlight default link uciConfigName Identifier |
| 27 | highlight default link uciOptionName Constant |
| 28 | highlight default link uciConfigDec Statement |
| 29 | highlight default link uciOptionType Type |
| 30 | highlight default link uciComment Comment |
| 31 | highlight default link uciString Normal |
| 32 | |
| 33 | let b:current_syntax = "uci" |