plugins: return to lazy.nvim's original syntax

This commit is contained in:
krolyxon 2023-02-18 22:54:45 +05:30
parent f7b14809c6
commit fd90625574
2 changed files with 18 additions and 30 deletions

View File

@ -1,15 +1,6 @@
local M = {} local M = {}
local merge_tb = vim.tbl_deep_extend local merge_tb = vim.tbl_deep_extend
M.format_plugins = function(plugins) local final_table = {}
for key, _ in pairs(plugins) do
plugins[key][1] = key
final_table[#final_table + 1] = plugins[key]
end
return final_table
end
M.close_buffer = function(bufnr) M.close_buffer = function(bufnr)
if vim.bo.buftype == "terminal" then if vim.bo.buftype == "terminal" then
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide") vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")

View File

@ -1,7 +1,6 @@
-- All plugins have lazy = true by default, to load a plugin on startup just lazy=false -- All plugins have lazy = true by default, to load a plugin on startup just lazy=false
local plugins = { local plugins = {
["~/repos/krose-pine"] = { { dir = "~/repos/krose-pine",
dir = "~/repos/krose-pine",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function() config = function()
@ -18,9 +17,9 @@ local plugins = {
end end
}, },
['nvim-lua/plenary.nvim'] = {}, { 'nvim-lua/plenary.nvim' },
["nvim-treesitter/nvim-treesitter"] = { { "nvim-treesitter/nvim-treesitter",
init = function() init = function()
require("core.utils").lazy_load "nvim-treesitter" require("core.utils").lazy_load "nvim-treesitter"
end, end,
@ -31,7 +30,7 @@ local plugins = {
end, end,
}, },
["lewis6991/gitsigns.nvim"] = { { "lewis6991/gitsigns.nvim",
ft = "gitcommit", ft = "gitcommit",
init = function() init = function()
-- load gitsigns only when a git file is opened -- load gitsigns only when a git file is opened
@ -53,7 +52,7 @@ local plugins = {
end, end,
}, },
["nvim-telescope/telescope.nvim"] = { { "nvim-telescope/telescope.nvim",
cmd = "Telescope", cmd = "Telescope",
config = function() config = function()
require "plugins.configs.telescope" require "plugins.configs.telescope"
@ -65,14 +64,14 @@ local plugins = {
-- lsp stuff -- lsp stuff
["williamboman/mason.nvim"] = { { "williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" }, cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
config = function() config = function()
require "plugins.configs.mason" require "plugins.configs.mason"
end, end,
}, },
["neovim/nvim-lspconfig"] = { { "neovim/nvim-lspconfig",
init = function() init = function()
require("core.utils").lazy_load "nvim-lspconfig" require("core.utils").lazy_load "nvim-lspconfig"
end, end,
@ -81,7 +80,7 @@ local plugins = {
end, end,
}, },
["simrat39/rust-tools.nvim"] = { { "simrat39/rust-tools.nvim",
-- after = "nvim-lspconfig", -- after = "nvim-lspconfig",
event = "BufEnter *.rs", event = "BufEnter *.rs",
dependencies = "neovim/nvim-lspconfig", dependencies = "neovim/nvim-lspconfig",
@ -91,7 +90,7 @@ local plugins = {
end, end,
}, },
["Saecki/crates.nvim"] = { { "Saecki/crates.nvim",
event = { "BufRead Cargo.toml" }, event = { "BufRead Cargo.toml" },
config = function() config = function()
require("crates").setup() require("crates").setup()
@ -102,7 +101,7 @@ local plugins = {
-- load luasnips + cmp related in insert mode only -- load luasnips + cmp related in insert mode only
["hrsh7th/nvim-cmp"] = { { "hrsh7th/nvim-cmp",
event = "InsertEnter", event = "InsertEnter",
dependencies = { dependencies = {
{ {
@ -138,7 +137,7 @@ local plugins = {
}, },
-- misc -- misc
['vimwiki/vimwiki'] = { { 'vimwiki/vimwiki',
event = "VeryLazy", event = "VeryLazy",
init = function() init = function()
vim.g.vimwiki_list = { vim.g.vimwiki_list = {
@ -151,7 +150,7 @@ local plugins = {
end, end,
}, },
["numToStr/Comment.nvim"] = { { "numToStr/Comment.nvim",
-- keys = { "gc", "gb" }, -- keys = { "gc", "gb" },
config = function() config = function()
require("Comment").setup() require("Comment").setup()
@ -161,14 +160,14 @@ local plugins = {
end, end,
}, },
["mbbill/undotree"] = { { "mbbill/undotree",
cmd = "UndotreeToggle", cmd = "UndotreeToggle",
init = function() init = function()
require("core.utils").load_mappings "undotree" require("core.utils").load_mappings "undotree"
end, end,
}, },
["krolyxon/kterm"] = { { "krolyxon/kterm",
config = function() config = function()
require "plugins.configs.kterm" require "plugins.configs.kterm"
end, end,
@ -179,7 +178,7 @@ local plugins = {
-- UI stuff -- UI stuff
["lukas-reineke/indent-blankline.nvim"] = { { "lukas-reineke/indent-blankline.nvim",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("plugins.configs.others").blankline() require("plugins.configs.others").blankline()
@ -190,7 +189,7 @@ local plugins = {
end, end,
}, },
["nvchad/nvim-colorizer.lua"] = { { "nvchad/nvim-colorizer.lua",
init = function() init = function()
require("core.utils").lazy_load "nvim-colorizer.lua" require("core.utils").lazy_load "nvim-colorizer.lua"
end, end,
@ -199,7 +198,7 @@ local plugins = {
end, end,
}, },
["nvim-lualine/lualine.nvim"] = { { "nvim-lualine/lualine.nvim",
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
require("plugins.configs.statusline") require("plugins.configs.statusline")
@ -207,7 +206,7 @@ local plugins = {
}, },
-- Only load whichkey after all the gui -- Only load whichkey after all the gui
["folke/which-key.nvim"] = { { "folke/which-key.nvim",
enabled = true, enabled = true,
keys = { "<leader>", "\"", "'", "`" }, keys = { "<leader>", "\"", "'", "`" },
config = function() config = function()
@ -219,8 +218,6 @@ local plugins = {
}, },
} }
plugins = require("core.utils").format_plugins(plugins)
-- pin commits for all default plugins -- pin commits for all default plugins
for _, value in pairs(plugins) do for _, value in pairs(plugins) do
value.pin = true value.pin = true