summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2013-03-08 13:30:43 -0500
committerWill Woods <wwoods@redhat.com>2013-03-08 13:30:43 -0500
commit13c96bea3913df284d88c3ed288bb1b0d150b9f7 (patch)
tree40970a7f03ef8af58727ed8fdb72fcfaa3f1a14e
parent6174c36b9e1985c8ba8b5bab1c83919be17f86b5 (diff)
downloadvim-scripts-13c96bea3913df284d88c3ed288bb1b0d150b9f7.tar.gz
vim-scripts-13c96bea3913df284d88c3ed288bb1b0d150b9f7.tar.xz
vim-scripts-13c96bea3913df284d88c3ed288bb1b0d150b9f7.zip
spec.vim: hilight Lua and handle all known sections
This adds correct hilighting for lua scriptlets, and we now handle all 22 known types of RPM spec parts. Whee!
-rw-r--r--syntax/spec.vim17
1 files changed, 14 insertions, 3 deletions
diff --git a/syntax/spec.vim b/syntax/spec.vim
index 57a390d..a8844a4 100644
--- a/syntax/spec.vim
+++ b/syntax/spec.vim
@@ -15,6 +15,9 @@ syn sync minlines=1000 " kinda dumb but specfiles are never *that* long
let b:is_bash=1
syntax include @Shell syntax/sh.vim
unlet b:current_syntax
+" and lua for those special places where we use the embedded lua interpreter
+syntax include @Lua syntax/lua.vim
+unlet b:current_syntax
" comments
syn region specComment start=/^\s*#/ end=/$/ contains=specTodo
@@ -63,9 +66,17 @@ syn match specCondition '.*$' contained contains=specMacro,specVersion,specConti
syn match specControl '^%\%(else\|endif\)\>'
" section markers
-syn match specSectionMarker '^%\%(description\|files\|package\|prep\|build\|install\|clean\|pre\|post\|preun\|postun\|posttrans\|changelog\)\>'
-" shell sections
-syn region specSectionShell matchgroup=specSectionMarker start='^%\%(prep\|build\|install\|clean\|preun\|postun\|posttrans\|pre\|post\|changelog\)' end='^%\%(description\|files\|package\|prep\|build\|install\|clean\|preun\|postun\|posttrans\|pre\|post\|changelog\)\>'me=s-1 contains=specMacro,specMacroNames,specControl,specDefine,specMacroCommands,@Shell
+" build sections
+syn match specSectionMarker '^%\%(prep\|build\|install\|check\|clean\)\>'
+" metadata sections
+syn match specSectionMarker '^%\%(package\|changelog\|description\|files\|policies\)\>'
+" scriptlet sections
+syn match specSectionMarker '^%\%(\%(pre\|post\)\%(un\|trans\)\?\|verifyscript\|trigger\%(in\|un\|prein\|postun\)\?\)'
+
+" scriptlet + build sections are shell..
+syn region specSectionShell matchgroup=specSectionMarker start='^%\%(prep\|build\|install\|check\|clean\|\%(pre\|post\)\%(un\|trans\)\?\|verifyscript\|trigger\%(in\|un\|prein\|postun\)\?\)' end='^%\%(prep\|build\|install\|check\|cleanpackage\|changelog\|description\|files\|policies\|\%(pre\|post\)\%(un\|trans\)\?\|verifyscript\|trigger\%(in\|un\|prein\|postun\)\?\)\>'me=s-1 contains=specMacro,specMacroNames,specControl,specDefine,specMacroCommands,@Shell
+" unless we request a different interpreter..
+syn region specSectionShell matchgroup=specSectionMarker start='^%\%(prep\|build\|install\|check\|clean\|\%(pre\|post\)\%(un\|trans\)\?\|verifyscript\|trigger\%(in\|un\|prein\|postun\)\?\).*\s-p\s*<lua>' end='^%\%(prep\|build\|install\|check\|cleanpackage\|changelog\|description\|files\|policies\|\%(pre\|post\)\%(un\|trans\)\?\|verifyscript\|trigger\%(in\|un\|prein\|postun\)\?\)\>'me=s-1 contains=specMacro,specMacroNames,specControl,specDefine,specMacroCommands,@Lua
" changelog section
syn region specChangeLog matchgroup=specSectionMarker start='^%changelog\>' end='^%' contains=specChangelogHeader,specURL,specBugID