blob: fdf5bfd9b3d50101c01c7a1361b4bff274ac4008 [file] [log] [blame]
Colin Caine4b3fab12024-04-18 23:53:02 +02001" 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
9if exists("b:current_syntax")
10 finish
11endif
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.
16syntax match uciOptionName '\%(\%(option\|list\)\s\+\)\@<=\S*'
17syntax match uciConfigName '\%(\%(package\|config\)\s\+\)\@<=\S*'
18syntax keyword uciConfigDec package config nextgroup=uciConfigName skipwhite
19syntax keyword uciOptionType option list nextgroup=uciOptionName skipwhite
20
21" Standard matches.
22syntax match uciComment "#.*$"
23syntax region uciString start=+"+ end=+"+ skip=+\\"+
24syntax region uciString start=+'+ end=+'+ skip=+\\'+
25
26highlight default link uciConfigName Identifier
27highlight default link uciOptionName Constant
28highlight default link uciConfigDec Statement
29highlight default link uciOptionType Type
30highlight default link uciComment Comment
31highlight default link uciString Normal
32
33let b:current_syntax = "uci"