diff --git a/README.md b/README.md index 11e18a4..365c6a0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [EditorConfig] plugin for the [`micro`] editor. Works with `micro` v2. +![Syntax Highlight](https://raw.githubusercontent.com/10sr/editorconfig-micro/master/assets/syntax_highlight.png) ### Prerequisites diff --git a/assets/syntax_highlight.png b/assets/syntax_highlight.png new file mode 100644 index 0000000..af222df Binary files /dev/null and b/assets/syntax_highlight.png differ diff --git a/editorconfig.lua b/editorconfig.lua index 8fdeb24..f763fe9 100644 --- a/editorconfig.lua +++ b/editorconfig.lua @@ -1,4 +1,4 @@ -VERSION = "1.0.0" +VERSION = "1.1.0" local micro = import("micro") local microBuffer = import("micro/buffer") @@ -155,3 +155,7 @@ end function init() config.AddRuntimeFile("editorconfig", config.RTHelp, "help/editorconfig.md") end + +-- outside init because we want these options to take effect before +-- buffers are initialized +config.AddRuntimeFile("editorconfig", config.RTSyntax, "syntax/editorconfig.yaml") diff --git a/repo.json b/repo.json index 93d7787..8ad3c9f 100644 --- a/repo.json +++ b/repo.json @@ -4,6 +4,13 @@ "Tags": ["editorconfig", "utility", "format"], "Website": "https://github.com/10sr/editorconfig-micro", "Versions": [ + { + "Version": "1.1.0", + "Url": "https://github.com/10sr/editorconfig-micro/archive/v1.1.0.zip", + "Require": { + "micro": ">=2.0.1" + } + }, { "Version": "1.0.0", "Url": "https://github.com/10sr/editorconfig-micro/archive/v1.0.0.zip", diff --git a/syntax/editorconfig.yaml b/syntax/editorconfig.yaml new file mode 100644 index 0000000..8d38ebe --- /dev/null +++ b/syntax/editorconfig.yaml @@ -0,0 +1,21 @@ +filetype: editorconfig + +detect: + filename: ".?editor-?config(?:config|-conf)?$" + +rules: + # Supported Properties + - statement: "\\b(indent_style|indent_size|tab_width|end_of_line|charset|trim_trailing_whitespace|insert_final_newline|root)\\b" + # Values + - special: "=\\s?.+" + # Files + - identifier: "^[[:space:]]*\\[.*\\]$" + # Brackets + - brightwhite: "\\[|]|{|}|,|=" + # Wildcard Patterns + - statement: "\\*|!|\\?" + + - comment: + start: "#" + end: "$" + rules: []