mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
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.
This commit is contained in:
parent
ab9a2c4925
commit
d6510eec4f
@ -1378,13 +1378,13 @@ local filename = {
|
||||
npmrc = 'dosini',
|
||||
['/etc/yum.conf'] = 'dosini',
|
||||
['.npmrc'] = 'dosini',
|
||||
['.editorconfig'] = 'dosini',
|
||||
['/etc/pacman.conf'] = 'confini',
|
||||
['mpv.conf'] = 'confini',
|
||||
dune = 'dune',
|
||||
jbuild = 'dune',
|
||||
['dune-workspace'] = 'dune',
|
||||
['dune-project'] = 'dune',
|
||||
['.editorconfig'] = 'editorconfig',
|
||||
['elinks.conf'] = 'elinks',
|
||||
['mix.lock'] = 'elixir',
|
||||
['filter-rules'] = 'elmfilt',
|
||||
|
18
runtime/syntax/editorconfig.vim
Normal file
18
runtime/syntax/editorconfig.vim
Normal file
@ -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'
|
@ -162,7 +162,7 @@ let s:filename_checks = {
|
||||
\ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
|
||||
\ 'dockerfile': ['Containerfile', 'Dockerfile', 'dockerfile', 'file.Dockerfile', 'file.dockerfile', 'Dockerfile.debian', 'Containerfile.something'],
|
||||
\ 'dosbatch': ['file.bat'],
|
||||
\ 'dosini': ['.editorconfig', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
|
||||
\ 'dosini': ['/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
|
||||
\ 'dot': ['file.dot', 'file.gv'],
|
||||
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
|
||||
\ 'dtd': ['file.dtd'],
|
||||
@ -174,6 +174,7 @@ let s:filename_checks = {
|
||||
\ 'dylanlid': ['file.lid'],
|
||||
\ 'ecd': ['file.ecd'],
|
||||
\ 'edif': ['file.edf', 'file.edif', 'file.edo'],
|
||||
\ 'editorconfig': ['.editorconfig'],
|
||||
\ 'eelixir': ['file.eex', 'file.leex'],
|
||||
\ 'elinks': ['elinks.conf'],
|
||||
\ 'elixir': ['file.ex', 'file.exs', 'mix.lock'],
|
||||
|
Loading…
Reference in New Issue
Block a user