wrap some opt modules with function

not doing so will make those modules load by default which isnt good
This commit is contained in:
siduck 2023-02-19 07:19:01 +05:30
parent a2690a4b72
commit a6b9c0cae5
3 changed files with 35 additions and 25 deletions

View File

@ -19,7 +19,8 @@ M.lazy = function(install_path)
vim.fn.mkdir(vim.g.base46_cache, "p") vim.fn.mkdir(vim.g.base46_cache, "p")
require("base46").load_all_highlights() require("base46").load_all_highlights()
require("lazy").load { plugins = "nvim-treesitter" }
vim.cmd "silent! lua require('lazy').load { plugins = 'nvim-treesitter' }"
-- install binaries from mason.nvim & tsparsers on LazySync -- install binaries from mason.nvim & tsparsers on LazySync
vim.schedule(function() vim.schedule(function()

View File

@ -43,8 +43,7 @@ M.luasnip = function()
}) })
end end
M.gitsigns = function() M.gitsigns = {
return {
signs = { signs = {
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" }, add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" }, change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
@ -57,6 +56,5 @@ M.gitsigns = function()
utils.load_mappings("gitsigns", { buffer = bufnr }) utils.load_mappings("gitsigns", { buffer = bufnr })
end, end,
} }
end
return M return M

View File

@ -20,7 +20,6 @@ local default_plugins = {
{ {
"NvChad/nvterm", "NvChad/nvterm",
init = require("core.utils").load_mappings "nvterm", init = require("core.utils").load_mappings "nvterm",
opts = {},
config = function(_, opts) config = function(_, opts)
require "base46.term" require "base46.term"
require("nvterm").setup(opts) require("nvterm").setup(opts)
@ -30,8 +29,8 @@ local default_plugins = {
{ {
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
init = require("core.utils").lazy_load "nvim-colorizer.lua", init = require("core.utils").lazy_load "nvim-colorizer.lua",
config = function() config = function(_, opts)
require("colorizer").setup() require("colorizer").setup(opts)
-- execute colorizer as soon as possible -- execute colorizer as soon as possible
vim.defer_fn(function() vim.defer_fn(function()
@ -57,7 +56,9 @@ local default_plugins = {
require("core.utils").lazy_load "indent-blankline.nvim" require("core.utils").lazy_load "indent-blankline.nvim"
require("core.utils").load_mappings "blankline" require("core.utils").load_mappings "blankline"
end, end,
opts = require("plugins.configs.others").blankline, opts = function()
return require("plugins.configs.others").blankline
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "blankline") dofile(vim.g.base46_cache .. "blankline")
require("indent_blankline").setup(opts) require("indent_blankline").setup(opts)
@ -69,7 +70,9 @@ local default_plugins = {
init = require("core.utils").lazy_load "nvim-treesitter", init = require("core.utils").lazy_load "nvim-treesitter",
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate", build = ":TSUpdate",
opts = require "plugins.configs.treesitter", opts = function()
return require "plugins.configs.treesitter"
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "syntax") dofile(vim.g.base46_cache .. "syntax")
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
@ -95,7 +98,9 @@ local default_plugins = {
end, end,
}) })
end, end,
opts = require("plugins.configs.others").gitsigns, opts = function()
return require("plugins.configs.others").gitsigns
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "git") dofile(vim.g.base46_cache .. "git")
require("gitsigns").setup(opts) require("gitsigns").setup(opts)
@ -106,7 +111,9 @@ local default_plugins = {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" }, cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
opts = require "plugins.configs.mason", opts = function()
return require "plugins.configs.mason"
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "mason") dofile(vim.g.base46_cache .. "mason")
require("mason").setup(opts) require("mason").setup(opts)
@ -188,7 +195,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 = require("core.utils").load_mappings "nvimtree",
opts = require "plugins.configs.nvimtree", opts = function()
return require "plugins.configs.nvimtree"
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree") dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts) require("nvim-tree").setup(opts)
@ -222,7 +231,9 @@ local default_plugins = {
enabled = false, enabled = false,
keys = { "<leader>", '"', "'", "`" }, keys = { "<leader>", '"', "'", "`" },
init = require("core.utils").load_mappings "whichkey", init = require("core.utils").load_mappings "whichkey",
opts = require "plugins.configs.whichkey", opts = function()
return require "plugins.configs.whichkey"
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey") dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts) require("which-key").setup(opts)