mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
feat(autocmds): added proper bigfile support
This commit is contained in:
parent
a33eabddd9
commit
938a6718c6
2 changed files with 28 additions and 0 deletions
|
@ -114,3 +114,25 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
|||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||
end,
|
||||
})
|
||||
|
||||
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(ev)
|
||||
vim.b.minianimate_disable = true
|
||||
vim.schedule(function()
|
||||
vim.bo[ev.buf].syntax = vim.filetype.match({ buf = ev.buf }) or ""
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -40,6 +40,12 @@ vim.g.lazyvim_statuscolumn = {
|
|||
-- Hide deprecation warnings
|
||||
vim.g.deprecation_warnings = false
|
||||
|
||||
-- Set filetype to `bigfile` for files larger than 1.5 MB
|
||||
-- Only vim syntax will be enabled (with the correct filetype)
|
||||
-- LSP, treesitter and other ft plugins will be disabled.
|
||||
-- mini.animate will also be disabled.
|
||||
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
|
||||
|
||||
-- Show the current document symbols location from Trouble in lualine
|
||||
vim.g.trouble_lualine = true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue