mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat: bigfile
This commit is contained in:
parent
c98c4c0307
commit
8d62b285d5
1 changed files with 6 additions and 7 deletions
|
|
@ -1,21 +1,20 @@
|
|||
---@class snacks.bigfile
|
||||
local M = {}
|
||||
|
||||
---@class snacks.bigfile.Config
|
||||
local defaults = {
|
||||
size = 1.5 * 1024 * 1024, -- 1.5MB
|
||||
---@param opts {buf: number, ft:string}
|
||||
behave = function(opts)
|
||||
---@param ev {buf: number, ft:string}
|
||||
behave = function(ev)
|
||||
vim.b.minianimate_disable = true
|
||||
vim.schedule(function()
|
||||
vim.bo.syntax = opts.ft
|
||||
vim.bo[ev.buf].syntax = ev.ft
|
||||
end)
|
||||
vim.notify("Big file detected, syntax highlighting disabled", "warn")
|
||||
end,
|
||||
}
|
||||
|
||||
---@param opts snacks.bigfile.Config?
|
||||
function M.setup(opts)
|
||||
opts = vim.tbl_deep_extend("force", defaults, opts or {})
|
||||
function M.setup()
|
||||
local opts = Snacks.config.get("bigfile", defaults)
|
||||
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue