treesitter html highlighting/injections

This commit is contained in:
2022-12-17 12:19:57 -06:00
parent 46a513cc74
commit 4b30748f16
5 changed files with 95 additions and 4 deletions
+1
View File
@@ -126,6 +126,7 @@ opt.mouse = ""
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]])
vim.cmd([[au BufRead,BufNewFile .env.* set filetype=sh]])
vim.cmd([[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]])
vim.cmd([[au BufRead,BufNewFile *.html set filetype=html]])
-- redo folds on write
vim.cmd([[au BufWrite * normal zx]])
+17 -4
View File
@@ -169,8 +169,7 @@ function M.lualine()
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {
},
lualine_z = {},
},
extensions = {},
})
@@ -180,11 +179,11 @@ function M.nvim_treesitter()
local highlight_disable = {
typescript = true,
tsx = true,
html = true,
--html = true,
javascript = true,
cpp = true,
}
local rainbow_disable = vim.tbl_extend("force", highlight_disable, { svelte = true })
local rainbow_disable = vim.tbl_extend("force", highlight_disable, { svelte = true, html = true })
local too_many_lines = function(bufnr)
return vim.api.nvim_buf_line_count(bufnr) > 5000
@@ -215,6 +214,19 @@ function M.nvim_treesitter()
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
end
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.htmldjango = {
install_info = {
url = "~/code/treesitter/tree-sitter-htmldjango", -- 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 = false, -- if folder contains pre-generated src/parser.c
},
filetype = "htmldjango", -- if filetype does not match the parser name
}
end
function M.nvim_lspconfig()
@@ -325,6 +337,7 @@ function M.nvim_lsp_installer()
"svelte",
"tailwindcss",
"zls",
"emmet_ls",
}
for _, s in ipairs(auto_servers) do
+1
View File
@@ -41,6 +41,7 @@ require("packer").startup(function(use)
run = ":TSUpdate",
})
use("nvim-treesitter/nvim-treesitter-context")
use("nvim-treesitter/playground")
use("neovim/nvim-lspconfig")
use("williamboman/nvim-lsp-installer")
use("nvim-lua/plenary.nvim")