mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 06:58:01 +00:00
[neovim] Disable heavy plugins on very large files
This commit is contained in:
parent
6194432e9e
commit
78d7f98156
@ -8,32 +8,32 @@
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"codeium.nvim": { "branch": "main", "commit": "dab91260a4299b41368e3ee424049f8d32534e4c" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "0437ef8bfdd67156d87140d692840a3c2824fa20" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"codeium.nvim": { "branch": "main", "commit": "822e762567a0bf50b1a4e733c8c93691934d7606" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
|
||||
"fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "39df33dad2cbf4eb9d17264bcda0c12e670ef1c2" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "e4dafc79cc7dcf4eec0547dbc6f3f3821b2f2b14" },
|
||||
"github-nvim-theme": { "branch": "main", "commit": "48f95f763e1a98e508260a20e448c3ff2d91213a" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
|
||||
"go.nvim": { "branch": "master", "commit": "44a32ebb4f1997e0aa70989100e82a620826a4ce" },
|
||||
"go.nvim": { "branch": "master", "commit": "000a433b37dbaf43bc236b2f6abc925929a61370" },
|
||||
"guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" },
|
||||
"karen-yank.nvim": { "branch": "main", "commit": "817f50c9464ce557c8f7f8f4d4c8d2f7b81fc40c" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "5579d72576b21b9c8c2d01838598aece5dc2be6d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "276e572f645430bcfd6fd25faa301ea9077f6ab1" },
|
||||
"leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "c17f3b3b1c8d95d71d87c6b46e8d12034e724cfa" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "fdbb6022e0905c7de948b51ff7491ad1717e849f" },
|
||||
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" },
|
||||
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" },
|
||||
"mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" },
|
||||
"mini.align": { "branch": "main", "commit": "86c8edae77023a7b71d0fa9e2bf78960c1e46fd8" },
|
||||
"mini.starter": { "branch": "main", "commit": "c7e027558477838eac7109d8576ff1f2d9804845" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "6f8c49956c89e9fefae6acdfe1d57c6293b0a03d" },
|
||||
"neovim-project": { "branch": "main", "commit": "99421264b110c93ed91850d98c2c44fa8fb47a87" },
|
||||
"neovim-session-manager": { "branch": "master", "commit": "df544e17798dd0e6e33ecf0991dfde9174367837" },
|
||||
"noice.nvim": { "branch": "main", "commit": "fcd01710ff6918d4d3ef90c8e36f3addacba13bf" },
|
||||
"neovim-project": { "branch": "main", "commit": "58814e09721846859b7414c56b19cbcc0fdb8497" },
|
||||
"neovim-session-manager": { "branch": "master", "commit": "68dde355a4304d83b40cf073f53915604bdd8e70" },
|
||||
"noice.nvim": { "branch": "main", "commit": "b990101f508b29470bfa16cdf3c08f040d85b435" },
|
||||
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "748e72c05495a3d30e88a6ef04b21697019a9aa9" },
|
||||
@ -41,19 +41,19 @@
|
||||
"nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "1d1c32b64b17b866152f29a3676a719cb6078028" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "6f2ccdf2da390d62f8f9e15fc5ddbcbd312e1e66" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "bb8e3dfbe10d80c294bb609c4bb4bba3ecdfbfe2" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "783e5fc3079680b307e8ac518935317907e71a59" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "f7eea53e88456403212df074b9aa3148a3908435" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
|
||||
"statuscol.nvim": { "branch": "main", "commit": "9ac4329786ba11dbfecb574526610cba5b439645" },
|
||||
"statuscol.nvim": { "branch": "main", "commit": "98d02fc90ebd7c4674ec935074d1d09443d49318" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5a747a9587e4bfc4ae086a38cc679fe54f983b69" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "a22472253249cd9a7b53e7d53fca7af6b988458f" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "a97c24c311e08365a69b092b2f6f3d31559f92e2" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "b0015e6e4b46a64192c64b68dec9a9ac5a4e5690" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "dce0ab49ae751f4f3617ab42d6f20c72369c7cb1" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "02219b557d4726a789be58c5d6bd6e139c46a9fe" },
|
||||
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
|
||||
"vim-kitty-navigator": { "branch": "master", "commit": "c3d8aaaa61717b2c142ff39553fcab709fd606a7" },
|
||||
|
@ -24,16 +24,6 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable illuminate on very large files
|
||||
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||
callback = function()
|
||||
local line_count = vim.api.nvim_buf_line_count(0)
|
||||
if line_count >= 5000 then
|
||||
vim.cmd("IlluminatePauseBuf")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Ensure terraform files use hcl LSP
|
||||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||
pattern = { "*.tf" },
|
||||
@ -43,3 +33,26 @@ vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||
]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable some plugins on very large files
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
pattern = { "*" },
|
||||
callback = function(args)
|
||||
local highlighter = require("vim.treesitter.highlighter")
|
||||
local ts_was_active = highlighter.active[args.buf]
|
||||
local file_size = vim.fn.getfsize(args.file)
|
||||
if file_size > 1024 * 1024 then
|
||||
vim.cmd("TSBufDisable highlight")
|
||||
vim.cmd("syntax off")
|
||||
vim.cmd("syntax clear")
|
||||
vim.cmd("IlluminatePauseBuf")
|
||||
vim.cmd("NoMatchParen")
|
||||
vim.cmd("UfoDisable")
|
||||
vim.cmd("IBLDisable")
|
||||
vim.cmd("LspStop")
|
||||
if ts_was_active then
|
||||
vim.notify("File larger than 1MB; syntax highlighting and heavy CPU use plugins turned off.")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user