robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #35832 from zeertzjq/vim-1e7a288c2c33249a7

master
2.3 KiB60 linesraw
1" Vim syntax file
2" Language:		Autoconf M4
3" Former Maintainer:	Christian Hammesr <ch@lathspell.westend.com>
4" Last Change:	2018 Feb 03
5" 				(patch from Yngve Inntjore Levinsen to detect AC_MSG)
6" 				(patch from Khym Chanur to add @Spell)
7" 				(patch from James McCoy to fix paren matching)
8" 				(2025 Sep 14 patch from Damien Lejay to detect unportable +=)
9" 				(2025 Sep 18 by Vim Project: fix inconsistent group name)
10
11" Well, I actually even do not know much about m4. This explains why there
12" is probably very much missing here, yet !
13" But I missed good highlighting when editing my GNU autoconf/automake
14" script, so I wrote this quick and dirty patch.
15
16
17" quit when a syntax file was already loaded
18if exists("b:current_syntax")
19  finish
20endif
21
22" define the config syntax
23syn match   configdelimiter "[()\[\];,]"
24syn match   configoperator  "[=|&\*\+\<\>]"
25syn match   configcomment   "\(dnl.*\)\|\(#.*\)" contains=configDnl,@Spell
26syn match   configfunction  "\<[A-Z_][A-Z0-9_]*\>"
27syn match   confignumber    "[-+]\=\<\d\+\(\.\d*\)\=\>"
28syn keyword configDnl   	dnl contained
29syn keyword configkeyword   if then else fi test for in do done
30syn keyword configspecial   cat rm eval
31
32" This shortens the script, see syn-ext-match..
33syn region  configstring    start=+\z(["'`]\)+ skip=+\\\z1+ end=+\z1+ contains=@Spell
34
35" Anything inside AC_MSG_TYPE([...])  and AC_MSG_TYPE(...) is a string.
36syn region  configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell
37syn region  configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell
38
39" Help write portable shell code
40syn match configPlusEq '\v\+\=' containedin=ALLBUT,configcomment
41
42" Define the default highlighting.
43" Only when an item doesn't have highlighting yet
44
45hi def link configdelimiter Delimiter
46hi def link configoperator  Operator
47hi def link configcomment   Comment
48hi def link configDnl  	 Comment
49hi def link configfunction  Function
50hi def link confignumber    Number
51hi def link configkeyword   Keyword
52hi def link configspecial   Special
53hi def link configstring    String
54hi def link configmsg       String
55hi def link configPlusEq    Error
56
57
58let b:current_syntax = "config"
59
60" vim: ts=4