use function in init opts for all plugins

if this isnt done then disabling a plugin will still have its init opt called, read https://github.com/NvChad/NvChad/discussions/1879
This commit is contained in:
siduck 2023-04-01 12:47:42 +05:30
parent 8ec2cb3b76
commit a5906e48fb
2 changed files with 24 additions and 9 deletions

View File

@ -329,7 +329,6 @@ M.nvterm = {
}, },
-- new -- new
["<leader>h"] = { ["<leader>h"] = {
function() function()
require("nvterm.terminal").new "horizontal" require("nvterm.terminal").new "horizontal"

View File

@ -26,7 +26,9 @@ local default_plugins = {
{ {
"NvChad/nvterm", "NvChad/nvterm",
init = require("core.utils").load_mappings "nvterm", init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts) config = function(_, opts)
require "base46.term" require "base46.term"
require("nvterm").setup(opts) require("nvterm").setup(opts)
@ -35,7 +37,9 @@ local default_plugins = {
{ {
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
init = require("core.utils").lazy_load "nvim-colorizer.lua", init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts) config = function(_, opts)
require("colorizer").setup(opts) require("colorizer").setup(opts)
@ -74,7 +78,9 @@ local default_plugins = {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
init = require("core.utils").lazy_load "nvim-treesitter", init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate", build = ":TSUpdate",
opts = function() opts = function()
@ -136,7 +142,9 @@ local default_plugins = {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
init = require("core.utils").lazy_load "nvim-lspconfig", init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function() config = function()
require "plugins.configs.lspconfig" require "plugins.configs.lspconfig"
end, end,
@ -194,7 +202,9 @@ local default_plugins = {
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
-- keys = { "gc", "gb" }, -- keys = { "gc", "gb" },
init = require("core.utils").load_mappings "comment", init = function()
require("core.utils").load_mappings "comment"
end,
config = function() config = function()
require("Comment").setup() require("Comment").setup()
end, end,
@ -204,7 +214,9 @@ local default_plugins = {
{ {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" }, cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = require("core.utils").load_mappings "nvimtree", init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function() opts = function()
return require "plugins.configs.nvimtree" return require "plugins.configs.nvimtree"
end, end,
@ -218,7 +230,9 @@ local default_plugins = {
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
cmd = "Telescope", cmd = "Telescope",
init = require("core.utils").load_mappings "telescope", init = function()
require("core.utils").load_mappings "telescope"
end,
opts = function() opts = function()
return require "plugins.configs.telescope" return require "plugins.configs.telescope"
@ -240,7 +254,9 @@ local default_plugins = {
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
keys = { "<leader>", '"', "'", "`" }, keys = { "<leader>", '"', "'", "`" },
init = require("core.utils").load_mappings "whichkey", init = function()
require("core.utils").load_mappings "whichkey"
end,
opts = function() opts = function()
return require "plugins.configs.whichkey" return require "plugins.configs.whichkey"
end, end,