feat(nvim-treesitter): migrate to main
This commit is contained in:
@@ -1,53 +1,54 @@
|
|||||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
|
|
||||||
|
local languages = {
|
||||||
|
"dap_repl",
|
||||||
|
"bash",
|
||||||
|
"zsh",
|
||||||
|
"python",
|
||||||
|
"c",
|
||||||
|
"cpp",
|
||||||
|
"lua",
|
||||||
|
"luadoc",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"php",
|
||||||
|
"phpdoc",
|
||||||
|
"rust",
|
||||||
|
"comment",
|
||||||
|
"gitcommit",
|
||||||
|
}
|
||||||
|
|
||||||
---@type LazyPluginSpec
|
---@type LazyPluginSpec
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
branch = "master",
|
lazy = false,
|
||||||
build = ":TSUpdate",
|
build = function()
|
||||||
event = "VeryLazy",
|
local ts = require("nvim-treesitter")
|
||||||
|
ts.install(languages):await(ts.update)
|
||||||
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"LiadOz/nvim-dap-repl-highlights",
|
"LiadOz/nvim-dap-repl-highlights",
|
||||||
config = true,
|
config = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {
|
config = function()
|
||||||
ensure_installed = {
|
local filetypes = {}
|
||||||
"c", -- recommended default
|
for _, lang in ipairs(languages) do
|
||||||
"lua", -- recommended default
|
for _, ft in ipairs(vim.treesitter.language.get_filetypes(lang)) do
|
||||||
"vim", -- recommended default
|
if not vim.list_contains(filetypes, ft) then
|
||||||
"vimdoc", -- recommended default
|
table.insert(filetypes, ft)
|
||||||
"query", -- recommended default
|
end
|
||||||
"luadoc",
|
end
|
||||||
"phpdoc",
|
end
|
||||||
"comment",
|
|
||||||
"dap_repl",
|
|
||||||
},
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
disable = { "dockerfile" },
|
|
||||||
|
|
||||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
pattern = filetypes,
|
||||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
callback = function()
|
||||||
-- Instead of true it can also be a list of languages
|
vim.treesitter.start()
|
||||||
additional_vim_regex_highlighting = { "org", "php", "python" },
|
vim.wo.foldmethod = "expr"
|
||||||
},
|
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
},
|
end,
|
||||||
config = function(_, opts)
|
})
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
|
||||||
|
|
||||||
vim.opt.foldmethod = "expr"
|
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
||||||
|
|
||||||
-- Disable LSP semantic highlighting for lua comments because it will
|
|
||||||
-- otherwise override highlights from `comment`.
|
|
||||||
vim.api.nvim_set_hl(0, "@lsp.type.comment.lua", {})
|
|
||||||
|
|
||||||
-- To set the priority of semantic highlighting lower than treesitter (100),
|
|
||||||
-- uncomment the line below:
|
|
||||||
-- vim.hl.priorities.semantic_tokens = 99
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user