feat(config): add large buffer handling
This commit is contained in:
parent
454ba629d8
commit
71c1bc295f
2 changed files with 32 additions and 3 deletions
25
config/largebuf.nix
Normal file
25
config/largebuf.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
# Adapted from AstroNvim and Reddit comment
|
||||||
|
# https://github.com/AstroNvim/astrocore/blob/v1.5.0/lua/astrocore/init.lua#L473-L486
|
||||||
|
# https://www.reddit.com/r/neovim/comments/z85s1l/comment/iyfrgvb/
|
||||||
|
autoGroups.large_buffer_detector = { };
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
desc = "Handle large buffers";
|
||||||
|
event = "BufRead";
|
||||||
|
group = "large_buffer_detector";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
if vim.b.large_buf then
|
||||||
|
vim.cmd("syntax off")
|
||||||
|
vim.cmd(("TSBufDisable %s"):format(args.buf))
|
||||||
|
vim.cmd("LspStop")
|
||||||
|
vim.opt_local.foldmethod = "manual"
|
||||||
|
vim.opt_local.spell = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
extra.packages = [
|
extra = {
|
||||||
|
packages = [
|
||||||
(import ./package { inherit lib pkgs; })
|
(import ./package { inherit lib pkgs; })
|
||||||
];
|
];
|
||||||
|
|
||||||
|
config = "require('astrocore').setup({})";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue