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.targets set ft=xml
|
||||
autocmd BufRead,BufNewFile *.axaml set ft=xml
|
||||
autocmd BufRead,BufNewFile *.xaml set ft=xml
|
||||
autocmd BufRead,BufNewFile *.cake set filetype=cs
|
||||
|
|
|
@ -22,7 +22,7 @@ function M.config()
|
|||
vim.g.terminal_color_13 = 13
|
||||
vim.g.terminal_color_14 = 14
|
||||
vim.g.terminal_color_15 = 15
|
||||
end -- }}}
|
||||
end -- }}}
|
||||
|
||||
local function normalizeCmpKindHighlight() -- {{{
|
||||
vim.api.nvim_set_hl(0, 'CmpItemKindClass', { link = 'Identifier' })
|
||||
|
@ -76,7 +76,7 @@ function M.config()
|
|||
|
||||
link('@tag.attribute', 'Identifier')
|
||||
link('@tag.delimiter', 'Delimiter')
|
||||
end -- }}}
|
||||
end -- }}}
|
||||
|
||||
local function normalizeTroubleHighlight() -- {{{
|
||||
copyFg('TroubleText', 'Normal')
|
||||
|
@ -153,6 +153,14 @@ function M.config()
|
|||
linenr_style = {}
|
||||
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('LspCodeLens', 'gray', nil, { 'italic' })
|
||||
|
||||
|
@ -160,11 +168,11 @@ function M.config()
|
|||
|
||||
link('DiagnosticSignOk', 'GruvboxGreenSign')
|
||||
|
||||
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', })
|
||||
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', })
|
||||
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic', })
|
||||
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic', })
|
||||
gr:hl('DiagnosticVirtualTextOk', 'ok', nil, { 'italic', })
|
||||
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic' })
|
||||
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic' })
|
||||
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic' })
|
||||
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic' })
|
||||
gr:hl('DiagnosticVirtualTextOk', 'ok', nil, { 'italic' })
|
||||
|
||||
-- gr:hl('GitSignsAddLine', nil, 'faded_green', {})
|
||||
-- vim.fn.sign_define('GitSignsAdd', { text = '│', texthl = 'GitSignsAdd', linehl = 'GitSignsAddLine', culhl='CursorLine' })
|
||||
|
|
|
@ -7,9 +7,63 @@ local M = {
|
|||
-- { dir = '/home/sogun/devel/nvim-yati/', }
|
||||
},
|
||||
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()
|
||||
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 {
|
||||
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
sync_install = false,
|
||||
|
@ -30,7 +84,7 @@ function M.config()
|
|||
},
|
||||
indent = {
|
||||
-- disable = { "php" },-- php indent SUCKS A LOT
|
||||
enable = false,
|
||||
enable = { 'xml' },
|
||||
},
|
||||
textobjects = {
|
||||
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
|
||||
|
||||
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