nvim: xml
This commit is contained in:
parent
f2e7131a22
commit
335a187ba7
5 changed files with 110 additions and 21 deletions
|
@ -1,4 +1,5 @@
|
||||||
autocmd BufRead,BufNewFile Directory.Build.props set ft=xml
|
autocmd BufRead,BufNewFile Directory.Build.props set ft=xml
|
||||||
autocmd BufRead,BufNewFile Directory.Build.targets set ft=xml
|
autocmd BufRead,BufNewFile Directory.Build.targets set ft=xml
|
||||||
autocmd BufRead,BufNewFile *.axaml set ft=xml
|
autocmd BufRead,BufNewFile *.axaml set ft=xml
|
||||||
|
autocmd BufRead,BufNewFile *.xaml set ft=xml
|
||||||
autocmd BufRead,BufNewFile *.cake set filetype=cs
|
autocmd BufRead,BufNewFile *.cake set filetype=cs
|
||||||
|
|
|
@ -153,6 +153,14 @@ function M.config()
|
||||||
linenr_style = {}
|
linenr_style = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
link('@tag.delimiter.xml', 'xmlTag')
|
||||||
|
link('@tag.xml', 'xmlTagName')
|
||||||
|
link('@tag.attribute.xml', 'xmlAttrib')
|
||||||
|
|
||||||
|
link('@tag.delimiter.html', 'htmlTag')
|
||||||
|
link('@tag.html', 'htmlTagName')
|
||||||
|
link('@tag.attribute.html', 'htmlArg')
|
||||||
|
|
||||||
gr:hl('LineNr', 'gray', 'dark0_hard', linenr_style)
|
gr:hl('LineNr', 'gray', 'dark0_hard', linenr_style)
|
||||||
gr:hl('LspCodeLens', 'gray', nil, { 'italic' })
|
gr:hl('LspCodeLens', 'gray', nil, { 'italic' })
|
||||||
|
|
||||||
|
@ -160,11 +168,11 @@ function M.config()
|
||||||
|
|
||||||
link('DiagnosticSignOk', 'GruvboxGreenSign')
|
link('DiagnosticSignOk', 'GruvboxGreenSign')
|
||||||
|
|
||||||
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', })
|
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic' })
|
||||||
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', })
|
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic' })
|
||||||
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic', })
|
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic' })
|
||||||
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic', })
|
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic' })
|
||||||
gr:hl('DiagnosticVirtualTextOk', 'ok', nil, { 'italic', })
|
gr:hl('DiagnosticVirtualTextOk', 'ok', nil, { 'italic' })
|
||||||
|
|
||||||
-- gr:hl('GitSignsAddLine', nil, 'faded_green', {})
|
-- gr:hl('GitSignsAddLine', nil, 'faded_green', {})
|
||||||
-- vim.fn.sign_define('GitSignsAdd', { text = '│', texthl = 'GitSignsAdd', linehl = 'GitSignsAddLine', culhl='CursorLine' })
|
-- vim.fn.sign_define('GitSignsAdd', { text = '│', texthl = 'GitSignsAdd', linehl = 'GitSignsAddLine', culhl='CursorLine' })
|
||||||
|
|
|
@ -7,9 +7,63 @@ local M = {
|
||||||
-- { dir = '/home/sogun/devel/nvim-yati/', }
|
-- { dir = '/home/sogun/devel/nvim-yati/', }
|
||||||
},
|
},
|
||||||
event = 'BufRead',
|
event = 'BufRead',
|
||||||
|
-- cmd {{{
|
||||||
|
cmd = {
|
||||||
|
'TSBufDisable',
|
||||||
|
'TSBufEnable',
|
||||||
|
'TSBufToggle',
|
||||||
|
'TSCaptureUnderCursor',
|
||||||
|
'TSConfigInfo',
|
||||||
|
'TSDisable',
|
||||||
|
'TSEditQuery',
|
||||||
|
'TSEditQueryUserAfter',
|
||||||
|
'TSEnable',
|
||||||
|
'TSHighlightCapturesUnderCursor',
|
||||||
|
'TSInstall',
|
||||||
|
'TSInstallFromGrammar',
|
||||||
|
'TSInstallInfo',
|
||||||
|
'TSInstallSync',
|
||||||
|
'TSModuleInfo',
|
||||||
|
'TSNodeUnderCursor',
|
||||||
|
'TSPlaygroundToggle',
|
||||||
|
'TSTextobjectBuiltinF',
|
||||||
|
'TSTextobjectBuiltinT',
|
||||||
|
'TSTextobjectBuiltinf',
|
||||||
|
'TSTextobjectBuiltint',
|
||||||
|
'TSTextobjectGotoNextEnd',
|
||||||
|
'TSTextobjectGotoNextStart',
|
||||||
|
'TSTextobjectGotoPreviousEnd',
|
||||||
|
'TSTextobjectGotoPreviousStart',
|
||||||
|
'TSTextobjectPeekDefinitionCode',
|
||||||
|
'TSTextobjectRepeatLastMove',
|
||||||
|
'TSTextobjectRepeatLastMoveNext',
|
||||||
|
'TSTextobjectRepeatLastMoveOpposite',
|
||||||
|
'TSTextobjectRepeatLastMovePrevious',
|
||||||
|
'TSTextobjectSelect',
|
||||||
|
'TSTextobjectSwapNext',
|
||||||
|
'TSTextobjectSwapPrevious',
|
||||||
|
'TSToggle',
|
||||||
|
'TSUninstall',
|
||||||
|
'TSUpdate',
|
||||||
|
'TSUpdateSync',
|
||||||
|
},
|
||||||
|
-- }}}
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
|
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
|
ts_parsers.xml = {
|
||||||
|
install_info = {
|
||||||
|
url = 'https://github.com/dorgnarg/tree-sitter-xml', -- local path or git repo
|
||||||
|
files = { 'src/parser.c' },
|
||||||
|
-- optional entries:
|
||||||
|
branch = 'main', -- default branch in case of git repo if different from master
|
||||||
|
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||||
|
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
||||||
|
},
|
||||||
|
filetype = 'xml', -- if filetype does not match the parser name
|
||||||
|
}
|
||||||
|
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
@ -30,7 +84,7 @@ function M.config()
|
||||||
},
|
},
|
||||||
indent = {
|
indent = {
|
||||||
-- disable = { "php" },-- php indent SUCKS A LOT
|
-- disable = { "php" },-- php indent SUCKS A LOT
|
||||||
enable = false,
|
enable = { 'xml' },
|
||||||
},
|
},
|
||||||
textobjects = {
|
textobjects = {
|
||||||
swap = {
|
swap = {
|
||||||
|
@ -80,19 +134,6 @@ function M.config()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
|
||||||
ts_parsers.xml = {
|
|
||||||
install_info = {
|
|
||||||
url = 'https://github.com/dorgnarg/tree-sitter-xml', -- local path or git repo
|
|
||||||
files = { 'src/parser.c' },
|
|
||||||
-- optional entries:
|
|
||||||
branch = 'main', -- default branch in case of git repo if different from master
|
|
||||||
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
|
||||||
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
|
||||||
},
|
|
||||||
filetype = 'xml', -- if filetype does not match the parser name
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
30
dot_config/nvim/queries/xml/highlights.scm
Normal file
30
dot_config/nvim/queries/xml/highlights.scm
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"</"
|
||||||
|
"/>"
|
||||||
|
] @tag.delimiter
|
||||||
|
|
||||||
|
"=" @operator
|
||||||
|
[
|
||||||
|
(start_tag)
|
||||||
|
(end_tag)
|
||||||
|
(xml_decl)
|
||||||
|
] @tag
|
||||||
|
(empty_elem_tag) @tag
|
||||||
|
|
||||||
|
[(doctype_decl) (xml_decl)] @keyword
|
||||||
|
(doctype) @string
|
||||||
|
(system_literal) @string
|
||||||
|
|
||||||
|
["encoding" "standalone" "version" ] @tag.attribute
|
||||||
|
[
|
||||||
|
(version_info)
|
||||||
|
(encoding_decl)
|
||||||
|
(standalone_decl)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
|
||||||
|
(attribute_name) @tag.attribute
|
||||||
|
(attribute_value) @string
|
||||||
|
(comment) @comment
|
9
dot_config/nvim/queries/xml/indents.scm
Normal file
9
dot_config/nvim/queries/xml/indents.scm
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
(prolog) @indent.zero
|
||||||
|
|
||||||
|
[
|
||||||
|
(start_tag)
|
||||||
|
(element)
|
||||||
|
] @indent.begin
|
||||||
|
|
||||||
|
[ (end_tag) ">" "/>"] @indent.branch
|
Loading…
Add table
Reference in a new issue