Fix treesitter config
This commit is contained in:
parent
8eb289f178
commit
e434548c90
|
@ -5,9 +5,28 @@ return {
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
},
|
},
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
config = function (_, opts)
|
config = function ()
|
||||||
require("nvim-treesitter").setup(opts)
|
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "typst", "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix", "bibtex" },
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
sync_install = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
disable = function(lang, buf) -- Disable if file size is too big
|
||||||
|
if lang == "ini" or lang == "markdown" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local max_filesize = 2000 * 1024 -- 2MB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
textobjects = {
|
textobjects = {
|
||||||
select = {
|
select = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
@ -46,26 +65,4 @@ return {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
opts = {
|
|
||||||
ensure_installed_sync = { "typst", "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix", "bibtex" },
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
sync_install = true,
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
disable = function(lang, buf) -- Disable if file size is too big
|
|
||||||
if lang == "ini" or lang == "markdown" then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
local max_filesize = 2000 * 1024 -- 2MB
|
|
||||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
||||||
if ok and stats and stats.size > max_filesize then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue