I have max file size rule for files, setup in treesitter config, it works:
require 'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
is_supported = function()
if vim.fn.strwidth(vim.fn.getline('.')) > 300 or vim.fn.getfsize(vim.fn.expand('%')) > 1024 * 1024
then
return false
else
return true
end
}
}
but this setup doesn't work in telescope preview buffer anyway...
I tried this to disable highlight for telescope, but it doesn't work:
vim.cmd([[ autocmd User TelescopePreviewerLoaded TSBufDisable highlight ]])
Is there a way to disable Treesiter in Telescope (ideally for big files only)?
UPD 1. Added this to my .config/nvim/after/plugin/telescope.lua
vim.cmd([[
autocmd User TelescopePreviewerLoaded set filetype=
]])
vim.cmd([[
autocmd User TelescopeFindPre set filetype=
]])
and no help .. syntax highlinght in file preview works anyway
UPD 2: What interesting, if disable treesitter at all like this:
require 'nvim-treesitter.configs'.setup {
highlight = {
enable = false,
}
}
it successfully disables treesitter in telescope file preview too, but i lose (of course) syntax highlighting in simply opened files