From 3e17d9ecd14ca5327b2d5ed3e702b4ebb3ff2892 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Fri, 16 Nov 2018 14:19:04 +0300 Subject: [PATCH] Improved RPM Spec highlighting --- README.md | 2 +- rpm-spec.sublime-syntax | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d6851fd..be69554 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ 1. Download the latest versions of `BLACKHOLE.sublime-color-scheme` and `*.sublime-syntax` files; 2. Copy them into directory `Sublime Text 3/Packages/User/`; -3. Go to Preferences → Color Scheme… and select BLACKHOLE. +3. Go to _Preferences_ → _Color Scheme…_ and select BLACKHOLE. ### License diff --git a/rpm-spec.sublime-syntax b/rpm-spec.sublime-syntax index 71c0018..3f7c406 100644 --- a/rpm-spec.sublime-syntax +++ b/rpm-spec.sublime-syntax @@ -35,6 +35,9 @@ contexts: - match: '"' scope: punctuation.definition.string.end.spec pop: true + - match: $ + scope: punctuation.definition.string.end.spec + pop: true - include: string-placeholder - include: string-escaped-char - match: "'" @@ -44,6 +47,9 @@ contexts: - match: "'" scope: punctuation.definition.string.end.spec pop: true + - match: $ + scope: punctuation.definition.string.end.spec + pop: true - include: string-placeholder - include: string-escaped-char @@ -60,10 +66,14 @@ contexts: scope: constant.numeric.integer.decimal.spec - match: '^[ \t]{0,}(cat|chmod|chown|cmake|cp|echo|exit|export|find|git|getent|groupadd|install|make|mkdir|ln|mv|patch|popd|pushd|rm|sed|service|svn|systemctl|touch|useradd)' scope: variable.function.spec - - match: \b(if|else|fi||elif|then|while|do|done)\b - scope: keyword.other - match: (&1>|&2>|&>|&>>|1>|2>) scope: keyword.operator + - match: \b(?>[\t ]*)(if|else|fi|elif|while|done)\b + captures: + 1: keyword.other + - match: (?>\;) *(do|then) + captures: + 1: keyword.other scriptlets: - match: '\%(package|description|prep|setup|build|install|files|clean|pretrans|posttrans|preun|postun|changelog|post|pre|check|triggerun|triggerin|triggerpostun|verifyscript) ?(-[a-z]{1,4})? ?([a-zA-Z_\-0-9\.]*)?'