summaryrefslogtreecommitdiff
path: root/lua/lvim/plugins.lua
diff options
context:
space:
mode:
authorLostNeophyte <[email protected]>2023-02-04 16:22:41 +0100
committerGitHub <[email protected]>2023-02-04 17:22:41 +0200
commit60c7ad77fddf6d23a2427844f368d247fef1ed5a (patch)
tree1af3e0387c31134b2f25a1569824aa5590c60b43 /lua/lvim/plugins.lua
parentc18cd3f0a89443d4265f6df8ce12fb89d627f09e (diff)
perf: lazy load most plugins (#3750)
* perf: lazy load most plugins * fix(lazy): suggested fixes for pref/lazyloading branch (#3754) fix(lazy): Suggested fixes from previous comments fix(lazy): applying suggestions from code review Co-authored-by: LostNeophyte <[email protected]> Co-authored-by: Pratyush Bharati <[email protected]> Co-authored-by: LostNeophyte <[email protected]> * chore: format * move lazy utils to modules.lua * simplify telescope actions * refactor: cmp_window local name * feat: more lazy loading cmds * refactor(cmp): minor clean up * perf: set lazy loading by default * refactor(alpha): remove broken lazy load * revert: explictily set lazy loading This reverts commit ba38193e4ebfa5acc8afa2b35247c5420d9a2739. * test: enable lazy-loading for bigfile * perf: defer projects and alpha to VimEnter * refactor(bufferline): add comment * perf: better lazy load dap/dapui * perf: lazy load ts-commentstring with Comment.nvim pre_hook --------- Co-authored-by: pr-313 <[email protected]> Co-authored-by: Pratyush Bharati <[email protected]> Co-authored-by: opalmay <[email protected]> Co-authored-by: kylo252 <[email protected]>
Diffstat (limited to 'lua/lvim/plugins.lua')
-rw-r--r--lua/lvim/plugins.lua52
1 files changed, 39 insertions, 13 deletions
diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua
index e1341398..d2efaf33 100644
--- a/lua/lvim/plugins.lua
+++ b/lua/lvim/plugins.lua
@@ -6,25 +6,34 @@ local core_plugins = {
lazy = true,
dependencies = { "mason-lspconfig.nvim", "nlsp-settings.nvim" },
},
- { "williamboman/mason-lspconfig.nvim", lazy = true },
- { "tamago324/nlsp-settings.nvim", lazy = true },
+ {
+ "williamboman/mason-lspconfig.nvim",
+ cmd = { "LspInstall", "LspUninstall" },
+ lazy = true,
+ dependencies = "mason.nvim",
+ },
+ { "tamago324/nlsp-settings.nvim", cmd = "LspSettings", lazy = true },
{ "jose-elias-alvarez/null-ls.nvim", lazy = true },
{
"williamboman/mason.nvim",
config = function()
require("lvim.core.mason").setup()
end,
+ cmd = { "Mason", "MasonInstall", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
+ lazy = true,
},
{
"folke/tokyonight.nvim",
+ lazy = not vim.startswith(lvim.colorscheme, "tokyonight"),
},
{
"lunarvim/lunar.nvim",
+ lazy = lvim.colorscheme ~= "lunar",
},
- { "Tastyep/structlog.nvim" },
+ { "Tastyep/structlog.nvim", lazy = true },
- { "nvim-lua/popup.nvim" },
- { "nvim-lua/plenary.nvim" },
+ { "nvim-lua/popup.nvim", lazy = true },
+ { "nvim-lua/plenary.nvim", cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" }, lazy = true },
-- Telescope
{
"nvim-telescope/telescope.nvim",
@@ -113,21 +122,24 @@ local core_plugins = {
vim.opt.rtp:prepend(path) -- treesitter needs to be before nvim's runtime in rtp
require("lvim.core.treesitter").setup()
end,
+ cmd = { "TSInstall", "TSUninstall", "TSUpdate", "TSInstallInfo", "TSInstallSync", "TSInstallFromGrammar" },
+ event = "User FileOpened",
},
{
+ -- Lazy loaded by Comment.nvim pre_hook
"JoosepAlviste/nvim-ts-context-commentstring",
- event = "VeryLazy",
+ lazy = true,
},
-- NvimTree
{
"kyazdani42/nvim-tree.lua",
- -- event = "BufWinOpen",
- -- cmd = "NvimTreeToggle",
config = function()
require("lvim.core.nvimtree").setup()
end,
enabled = lvim.builtin.nvimtree.active,
+ cmd = { "NvimTreeToggle", "NvimTreeOpen", "NvimTreeFocus", "NvimTreeFindFileToggle" },
+ event = "User DirOpened",
},
-- Lir
{
@@ -136,13 +148,15 @@ local core_plugins = {
require("lvim.core.lir").setup()
end,
enabled = lvim.builtin.lir.active,
+ event = "User DirOpened",
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("lvim.core.gitsigns").setup()
end,
- event = "BufRead",
+ event = "User FileOpened",
+ cmd = "Gitsigns",
enabled = lvim.builtin.gitsigns.active,
},
@@ -152,6 +166,7 @@ local core_plugins = {
config = function()
require("lvim.core.which-key").setup()
end,
+ cmd = "WhichKey",
event = "VeryLazy",
enabled = lvim.builtin.which_key.active,
},
@@ -159,10 +174,11 @@ local core_plugins = {
-- Comments
{
"numToStr/Comment.nvim",
- event = "BufRead",
config = function()
require("lvim.core.comment").setup()
end,
+ keys = { { "gc", mode = { "n", "v" } }, { "gb", mode = { "n", "v" } } },
+ event = "User FileOpened",
enabled = lvim.builtin.comment.active,
},
@@ -173,12 +189,15 @@ local core_plugins = {
require("lvim.core.project").setup()
end,
enabled = lvim.builtin.project.active,
+ event = "VimEnter",
+ cmd = "Telescope projects",
},
-- Icons
{
"nvim-tree/nvim-web-devicons",
enabled = lvim.use_icons,
+ lazy = true,
},
-- Status Line and Bufferline
@@ -189,6 +208,7 @@ local core_plugins = {
config = function()
require("lvim.core.lualine").setup()
end,
+ event = "VimEnter",
enabled = lvim.builtin.lualine.active,
},
@@ -198,6 +218,7 @@ local core_plugins = {
config = function()
require("lvim.core.breadcrumbs").setup()
end,
+ event = "User FileOpened",
enabled = lvim.builtin.breadcrumbs.active,
},
@@ -207,16 +228,17 @@ local core_plugins = {
require("lvim.core.bufferline").setup()
end,
branch = "main",
+ event = "User FileOpened",
enabled = lvim.builtin.bufferline.active,
},
-- Debugging
{
"mfussenegger/nvim-dap",
- -- event = "BufWinEnter",
config = function()
require("lvim.core.dap").setup()
end,
+ lazy = true,
enabled = lvim.builtin.dap.active,
},
@@ -226,6 +248,7 @@ local core_plugins = {
config = function()
require("lvim.core.dap").setup_ui()
end,
+ lazy = true,
enabled = lvim.builtin.dap.active,
},
@@ -236,6 +259,7 @@ local core_plugins = {
require("lvim.core.alpha").setup()
end,
enabled = lvim.builtin.alpha.active,
+ event = "VimEnter",
},
-- Terminal
@@ -260,7 +284,7 @@ local core_plugins = {
config = function()
require("lvim.core.illuminate").setup()
end,
- event = "VeryLazy",
+ event = "User FileOpened",
enabled = lvim.builtin.illuminate.active,
},
@@ -269,6 +293,7 @@ local core_plugins = {
config = function()
require("lvim.core.indentlines").setup()
end,
+ event = "User FileOpened",
enabled = lvim.builtin.indentlines.active,
},
@@ -283,7 +308,7 @@ local core_plugins = {
end
end)
end,
- enabled = lvim.colorscheme == "onedarker",
+ lazy = lvim.colorscheme ~= "onedarker",
},
{
@@ -294,6 +319,7 @@ local core_plugins = {
end)
end,
enabled = lvim.builtin.bigfile.active,
+ event = { "FileReadPre", "BufReadPre", "User FileOpened" },
},
}