Skip to content

Commit

Permalink
feat(snacks): bigfile module
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamHsieh committed Dec 18, 2024
1 parent 8976669 commit 330e084
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
13 changes: 0 additions & 13 deletions config/nvim/lua/core/autocmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,11 @@ vim.api.nvim_create_autocmd("BufWritePre", {
end,
})

vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
vim.filetype.add {
pattern = {
[".*"] = {
function(path, buf)
return vim.bo[buf].filetype ~= "bigfile" and path and vim.fn.getfsize(path) > vim.g.bigfile_size and "bigfile"
or nil
end,
},
},
}

vim.api.nvim_create_autocmd("FileType", {
group = augroup("bigfile"),
pattern = "bigfile",
callback = function(event)
vim.schedule(function()
vim.bo[event.buf].syntax = vim.filetype.match { buf = event.buf } or ""
require("core.utils").on_load("noice.nvim", vim.schedule_wrap(require("noice").disable))
end)
end,
Expand Down
1 change: 1 addition & 0 deletions config/nvim/lua/plugins/snacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ return {

---@type snacks.config
opts = {
bigfile = { enabled = true },
quickfile = { enabled = true },
statuscolumn = { enabled = true },
scroll = { enabled = true },
Expand Down
4 changes: 3 additions & 1 deletion config/nvim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ local M = {
}

function M.config()
vim.g.matchup_matchparen_offscreen = { method = "popup" }
-- disable if ts-context is enable in current buffer
vim.g.matchup_matchparen_offscreen = { method = "status_manual" }
vim.g.bigfile_size = 1.5 * 1024 * 1024

---@diagnostic disable-next-line: missing-fields
require("nvim-treesitter.configs").setup {
Expand Down

0 comments on commit 330e084

Please sign in to comment.