nvim: Turn off treesitter highlights in big files
Files above 1000 lines, 300 linelength or really big filesize.
This commit is contained in:
parent
7f112816b0
commit
1def627edd
1 changed files with 11 additions and 1 deletions
|
@ -7,11 +7,21 @@ return {
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
ensure_installed = "all",
|
ensure_installed = "all",
|
||||||
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
language_tree = true,
|
||||||
disable = function(_, bufnr)
|
disable = function(_, bufnr)
|
||||||
return vim.api.nvim_buf_line_count(bufnr) > 7000
|
if
|
||||||
|
vim.api.nvim_buf_line_count(bufnr) > 1000
|
||||||
|
or vim.fn.strwidth(vim.fn.getline(".")) > 300
|
||||||
|
or vim.fn.getfsize(vim.fn.expand("%")) > 1024*1024
|
||||||
|
then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
end,
|
end,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
incremental_selection = { enable = true },
|
incremental_selection = { enable = true },
|
||||||
textobjects = { enable = true },
|
textobjects = { enable = true },
|
||||||
|
|
Loading…
Reference in a new issue