Skip to content

Commit

Permalink
Nvim: removed filesize handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Dec 18, 2024
1 parent a1d1b44 commit 0a59d85
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions .config/nvim/lua/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)

local function disable_plugins_for_large_files()
local max_filesize = 1024 * 1024 -- 1 MB
local filepath = vim.fn.expand("%:p")
local filesize = vim.fn.getfsize(filepath)

if filesize <= max_filesize then
return
end

-- Disable treesitter
local filetype = vim.bo.filetype
if filetype ~= "" then
vim.cmd("TSBufDisable " .. filetype)
end

-- Disable nvim-cmp
local cmp = require("cmp")
if cmp then
cmp.setup.buffer({ enabled = false })
end

vim.api.nvim_echo({
{ "Plugins disabled for large file: " .. filepath, "WarningMsg" },
}, false, {})
end

-- Autocmd to check file size on BufRead
vim.api.nvim_create_autocmd("BufRead", {
callback = disable_plugins_for_large_files,
desc = "Disable heavy plugins for large files",
})

require("lazy").setup({
root = lazy_home,
spec = {
Expand Down

0 comments on commit 0a59d85

Please sign in to comment.