Files
johannes 9b0446c5f6 feat: initial commit
- basic config according to spec
2026-11-05 15:04:29 +01:00

37 lines
889 B
Lua

-- Files above the limit get vim.b.bigfile = true. Treesitter, LSP, linting and
-- AI completion check that flag; syntax and folding are switched off here.
local M = {}
M.limit = 1024 * 1024
local group = vim.api.nvim_create_augroup("core.bigfile", { clear = true })
vim.api.nvim_create_autocmd("BufReadPre", {
group = group,
callback = function(ev)
local stat = vim.uv.fs_stat(ev.match)
if stat and stat.size > M.limit then
vim.b[ev.buf].bigfile = true
end
end,
})
vim.api.nvim_create_autocmd("FileType", {
group = group,
callback = function(ev)
if not vim.b[ev.buf].bigfile then
return
end
vim.schedule(function()
if vim.api.nvim_buf_is_valid(ev.buf) then
vim.bo[ev.buf].syntax = ""
vim.api.nvim_buf_call(ev.buf, function()
vim.wo.foldmethod = "manual"
end)
end
end)
end,
})
return M