aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-01-03 09:13:35 -0700
committerGregory Anders <greg@gpanders.com>2023-01-03 10:28:55 -0700
commitd6510eec4f5e4d1ca08f685f9ce7984ca9ab1c9e (patch)
tree486250855a352ca3fdcfa19db4f1e9570ce505b5 /runtime/syntax
parentab9a2c49253413dbbb31756a3eeddb354a663035 (diff)
downloadrneovim-d6510eec4f5e4d1ca08f685f9ce7984ca9ab1c9e.tar.gz
rneovim-d6510eec4f5e4d1ca08f685f9ce7984ca9ab1c9e.tar.bz2
rneovim-d6510eec4f5e4d1ca08f685f9ce7984ca9ab1c9e.zip
feat(editorconfig): add editorconfig syntax file
This is intentionally _not_ copied from Vim because our syntax file makes use of Lua to dynamically generate a list of valid EditorConfig properties. This requires the builtin editorconfig module, which Vim does not have.
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/editorconfig.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/syntax/editorconfig.vim b/runtime/syntax/editorconfig.vim
new file mode 100644
index 0000000000..006b99cec5
--- /dev/null
+++ b/runtime/syntax/editorconfig.vim
@@ -0,0 +1,18 @@
+runtime! syntax/dosini.vim
+unlet! b:current_syntax
+
+syntax match editorconfigInvalidProperty "^\s*\zs\w\+\ze\s*="
+syntax keyword editorconfigProperty root
+
+lua<<
+local props = {}
+for k in pairs(require('editorconfig').properties) do
+ props[#props + 1] = k
+end
+vim.cmd(string.format('syntax keyword editorconfigProperty %s', table.concat(props, ' ')))
+.
+
+hi def link editorconfigInvalidProperty Error
+hi def link editorconfigProperty dosiniLabel
+
+let b:current_syntax = 'editorconfig'