add option to toggle lazy load for cmp and related

This commit is contained in:
siduck 2022-01-11 18:43:09 +05:30
parent a21ee2f22f
commit b1338beb0f
2 changed files with 11 additions and 8 deletions

View file

@ -76,6 +76,9 @@ M.plugins = {
init_file = "plugins.packerInit", init_file = "plugins.packerInit",
}, },
autopairs = { loadAfter = "nvim-cmp" }, autopairs = { loadAfter = "nvim-cmp" },
cmp = {
lazy_load = true,
},
lspconfig = { lspconfig = {
setup_lspconf = "", -- path of file containing setups of different lsps setup_lspconf = "", -- path of file containing setups of different lsps
}, },

View file

@ -132,7 +132,7 @@ return packer.startup(function()
use { use {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "friendly-snippets", after = plugin_settings.options.cmp.lazy_load and "friendly-snippets",
config = override_req("nvim_cmp", "plugins.configs.cmp"), config = override_req("nvim_cmp", "plugins.configs.cmp"),
} }
@ -140,44 +140,44 @@ return packer.startup(function()
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
wants = "friendly-snippets", wants = "friendly-snippets",
after = "nvim-cmp", after = plugin_settings.options.cmp.lazy_load and "nvim-cmp",
config = override_req("luasnip", "(plugins.configs.others).luasnip()"), config = override_req("luasnip", "(plugins.configs.others).luasnip()"),
} }
use { use {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "LuaSnip", after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
} }
use { use {
"hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lua",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "cmp_luasnip", after = plugin_settings.options.cmp.lazy_load and "cmp_luasnip",
} }
use { use {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "cmp-nvim-lua", after = plugin_settings.options.cmp.lazy_load and "cmp-nvim-lua",
} }
use { use {
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "cmp-nvim-lsp", after = plugin_settings.options.cmp.lazy_load and "cmp-nvim-lsp",
} }
use { use {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
disable = not plugin_settings.status.cmp, disable = not plugin_settings.status.cmp,
after = "cmp-buffer", after = plugin_settings.options.cmp.lazy_load and "cmp-buffer",
} }
-- misc plugins -- misc plugins
use { use {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
disable = not plugin_settings.status.autopairs, disable = not plugin_settings.status.autopairs,
after = plugin_settings.options.autopairs.loadAfter, after = plugin_settings.options.cmp.lazy_load and plugin_settings.options.autopairs.loadAfter,
config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"), config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"),
} }