mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(extras): add bigfile
This commit is contained in:
parent
e3075b05ef
commit
7bada92d51
1 changed files with 20 additions and 0 deletions
20
lua/lazyvim/plugins/extras/editor/big-file.lua
Normal file
20
lua/lazyvim/plugins/extras/editor/big-file.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
"LunarVim/bigfile.nvim",
|
||||
event = "BufReadPre",
|
||||
-- Disables LSP/treesitter, etc for files above 5000 lines (even if they have really long lines)
|
||||
opts = {
|
||||
pattern = function(bufnr, filesize_mib)
|
||||
if filesize_mib >= 2 then
|
||||
return true
|
||||
end
|
||||
-- you can't use `nvim_buf_line_count` because this runs on BufReadPre
|
||||
local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr))
|
||||
local file_length = #file_contents
|
||||
if file_length > 5000 then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue