mirror of
https://github.com/DefectingCat/nvim
synced 2025-07-16 17:21:33 +00:00
update large file detection
This commit is contained in:
@ -1,12 +1,3 @@
|
||||
-- Detect large files and disable syntax highlighting for them
|
||||
local file_larger_than_100_kb = function(buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
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
|
||||
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
@ -48,11 +39,11 @@ return {
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = function(_, buf)
|
||||
return not file_larger_than_100_kb(buf)
|
||||
enable = function()
|
||||
return not vim.b.large_buf
|
||||
end,
|
||||
disable = function(_, buf)
|
||||
return file_larger_than_100_kb(buf)
|
||||
disable = function()
|
||||
return vim.b.large_buf
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user