Add ansible syntax highlighting
This commit is contained in:
parent
8274fd84bf
commit
e8ab9ee331
5 changed files with 102 additions and 11 deletions
|
|
@ -416,17 +416,29 @@
|
||||||
"font_style": ""
|
"font_style": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ansible Keyword",
|
"name": "Ansible Task Name",
|
||||||
"scope": "keyword.other.ansible",
|
"scope": "keyword.other.ansible.task.name",
|
||||||
"foreground": "var(function)",
|
"foreground": "var(function)",
|
||||||
"font_style": ""
|
"font_style": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ansible Title",
|
"name": "Ansible Task Description",
|
||||||
"scope": "string.quoted.double.ansible",
|
"scope": "keyword.other.ansible.task.desc",
|
||||||
"foreground": "var(string)",
|
"foreground": "#65B0D8",
|
||||||
"font_style": "bold"
|
"font_style": "bold"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Ansible Block",
|
||||||
|
"scope": "keyword.other.ansible.block",
|
||||||
|
"foreground": "var(function)",
|
||||||
|
"font_style": "italic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ansible Action Name",
|
||||||
|
"scope": "keyword.other.ansible.action.name",
|
||||||
|
"foreground": "#B7AE89",
|
||||||
|
"font_style": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"scope": "entity.name.filename",
|
"scope": "entity.name.filename",
|
||||||
"foreground": "#DBC33F"
|
"foreground": "#DBC33F"
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ cd "$(bat --config-dir)/syntaxes"
|
||||||
curl -OL# -o "bibop-recipe.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/bibop-recipe.sublime-syntax
|
curl -OL# -o "bibop-recipe.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/bibop-recipe.sublime-syntax
|
||||||
curl -OL# -o "knf.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/knf.sublime-syntax
|
curl -OL# -o "knf.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/knf.sublime-syntax
|
||||||
curl -OL# -o "rpm-spec.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rpm-spec.sublime-syntax
|
curl -OL# -o "rpm-spec.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rpm-spec.sublime-syntax
|
||||||
|
curl -OL# -o "ansible.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/ansible.sublime-syntax
|
||||||
bat cache --build
|
bat cache --build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
82
ansible.sublime-syntax
Normal file
82
ansible.sublime-syntax
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# https://www.sublimetext.com/docs/syntax.html
|
||||||
|
name: Ansible
|
||||||
|
file_extensions:
|
||||||
|
- yml
|
||||||
|
- yaml
|
||||||
|
scope: source.ansible
|
||||||
|
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: comments
|
||||||
|
- include: keywords
|
||||||
|
- include: jinja
|
||||||
|
- include: strings
|
||||||
|
- include: tasks
|
||||||
|
- include: conditionals
|
||||||
|
|
||||||
|
comments:
|
||||||
|
- match: ^[\t ]*#
|
||||||
|
scope: punctuation.definition.comment
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line
|
||||||
|
- include: pop-on-line-end
|
||||||
|
- match: ^[\-]{3}
|
||||||
|
scope: comment.line
|
||||||
|
|
||||||
|
keywords:
|
||||||
|
- match: \b(true|false)\b
|
||||||
|
scope: constant.language.boolean.yaml
|
||||||
|
- match: '\b([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?\d+)?\b'
|
||||||
|
scope: constant.numeric.float
|
||||||
|
- match: '\b\d+\b'
|
||||||
|
scope: constant.numeric.integer
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- match: (\-) (name)(:)\ +(.*)
|
||||||
|
scope: keyword.other.ansible.task
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator
|
||||||
|
2: keyword.other.ansible.task.name
|
||||||
|
3: keyword.operator.assignment
|
||||||
|
4: keyword.other.ansible.task.desc
|
||||||
|
- match: '[ ]{2,}block(:)'
|
||||||
|
scope: keyword.other.ansible.block
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment
|
||||||
|
- match: '[ ]{2,}([\w\d]+)(:)'
|
||||||
|
scope: keyword.other.ansible.action
|
||||||
|
captures:
|
||||||
|
1: keyword.other.ansible.action.name
|
||||||
|
2: keyword.operator.assignment
|
||||||
|
|
||||||
|
conditionals:
|
||||||
|
- match: \b(is|or|and|(or )?not|if|else|(((un)?defined)))\b
|
||||||
|
scope: constant.character
|
||||||
|
|
||||||
|
strings:
|
||||||
|
- match: '"'
|
||||||
|
scope: punctuation.definition.string.begin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double
|
||||||
|
- match: '"'
|
||||||
|
scope: punctuation.definition.string.end
|
||||||
|
pop: true
|
||||||
|
- include: jinja-variable
|
||||||
|
- match: "'"
|
||||||
|
scope: punctuation.definition.string.begin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single
|
||||||
|
- match: "'"
|
||||||
|
scope: punctuation.definition.string.end
|
||||||
|
pop: true
|
||||||
|
- include: jinja-variable
|
||||||
|
|
||||||
|
jinja-variable:
|
||||||
|
- match: (\{\{ *[^\{\}]+ *\}\})|(\$\{[^\{\}]+\})
|
||||||
|
scope: storage.type.ansible
|
||||||
|
|
||||||
|
pop-on-line-end:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
# https://www.sublimetext.com/docs/syntax.html
|
||||||
name: Bibop Recipe
|
name: Bibop Recipe
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- recipe
|
- recipe
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
# https://www.sublimetext.com/docs/syntax.html
|
||||||
name: KNF
|
name: KNF
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- knf
|
- knf
|
||||||
|
|
@ -34,8 +34,6 @@ contexts:
|
||||||
- match: '"'
|
- match: '"'
|
||||||
scope: punctuation.definition.string.end.knf
|
scope: punctuation.definition.string.end.knf
|
||||||
pop: true
|
pop: true
|
||||||
- include: string-placeholder
|
|
||||||
- include: string-escaped-char
|
|
||||||
- match: "'"
|
- match: "'"
|
||||||
scope: punctuation.definition.string.begin.knf
|
scope: punctuation.definition.string.begin.knf
|
||||||
push:
|
push:
|
||||||
|
|
@ -43,8 +41,6 @@ contexts:
|
||||||
- match: "'"
|
- match: "'"
|
||||||
scope: punctuation.definition.string.end.knf
|
scope: punctuation.definition.string.end.knf
|
||||||
pop: true
|
pop: true
|
||||||
- include: string-placeholder
|
|
||||||
- include: string-escaped-char
|
|
||||||
|
|
||||||
macroses:
|
macroses:
|
||||||
- match: \{([A-Za-z0-9_-]{1,}):([A-Za-z0-9_-]{1,})\}
|
- match: \{([A-Za-z0-9_-]{1,}):([A-Za-z0-9_-]{1,})\}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue