neovim-config/lua/plugins/init.lua
2022-11-19 12:02:07 +05:30

239 lines
5.8 KiB
Lua

-- List of all default plugins & their definitions
local plugins = {
["nvim-lua/plenary.nvim"] = { module = "plenary" },
["lewis6991/impatient.nvim"] = {},
["wbthomason/packer.nvim"] = {
cmd = {
"PackerSnapshot",
"PackerSnapshotRollback",
"PackerSnapshotDelete",
"PackerInstall",
"PackerUpdate",
"PackerSync",
"PackerClean",
"PackerCompile",
"PackerStatus",
"PackerProfile",
"PackerLoad",
},
config = function()
require "plugins"
end,
},
["NvChad/extensions"] = { module = { "telescope", "nvchad" } },
["NvChad/base46"] = {
branch = "dev",
config = function()
pcall(function()
loadfile(vim.g.base46_cache .. "defaults")()
end)
end,
},
["NvChad/ui"] = {
after = "base46",
branch = "dev",
config = function()
local present, nvchad_ui = pcall(require, "nvchad_ui")
if present then
nvchad_ui.setup()
end
end,
},
["NvChad/nvterm"] = {
module = "nvterm",
config = function()
require "plugins.configs.nvterm"
end,
setup = function()
require("core.utils").load_mappings "nvterm"
end,
},
["kyazdani42/nvim-web-devicons"] = {
after = "ui",
module = "nvim-web-devicons",
config = function()
require("plugins.configs.others").devicons()
end,
},
["lukas-reineke/indent-blankline.nvim"] = {
opt = true,
setup = function()
require("core.utils").lazy_load "indent-blankline.nvim"
require("core.utils").load_mappings "blankline"
end,
config = function()
require("plugins.configs.others").blankline()
end,
},
["NvChad/nvim-colorizer.lua"] = {
opt = true,
setup = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function()
require("plugins.configs.others").colorizer()
end,
},
["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter",
setup = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" },
run = ":TSUpdate",
config = function()
require "plugins.configs.treesitter"
end,
},
-- git stuff
["lewis6991/gitsigns.nvim"] = {
ft = "gitcommit",
setup = function()
-- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function()
vim.fn.system("git -C " .. vim.fn.expand "%:p:h" .. " rev-parse")
if vim.v.shell_error == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("packer").loader "gitsigns.nvim"
end)
end
end,
})
end,
config = function()
require("plugins.configs.others").gitsigns()
end,
},
-- lsp stuff
["williamboman/mason.nvim"] = {
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
config = function()
require "plugins.configs.mason"
end,
},
["neovim/nvim-lspconfig"] = {
opt = true,
setup = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
-- load luasnips + cmp related in insert mode only
["rafamadriz/friendly-snippets"] = {
module = { "cmp", "cmp_nvim_lsp" },
event = "InsertEnter",
},
["hrsh7th/nvim-cmp"] = {
after = "friendly-snippets",
config = function()
require "plugins.configs.cmp"
end,
},
["L3MON4D3/LuaSnip"] = {
wants = "friendly-snippets",
after = "nvim-cmp",
config = function()
require("plugins.configs.others").luasnip()
end,
},
["saadparwaiz1/cmp_luasnip"] = { after = "LuaSnip" },
["hrsh7th/cmp-nvim-lua"] = { after = "cmp_luasnip" },
["hrsh7th/cmp-nvim-lsp"] = { after = "cmp-nvim-lua" },
["hrsh7th/cmp-buffer"] = { after = "cmp-nvim-lsp" },
["hrsh7th/cmp-path"] = { after = "cmp-buffer" },
-- misc plugins
["windwp/nvim-autopairs"] = {
after = "nvim-cmp",
config = function()
require("plugins.configs.others").autopairs()
end,
},
["numToStr/Comment.nvim"] = {
module = "Comment",
keys = { "gc", "gb" },
config = function()
require("plugins.configs.others").comment()
end,
setup = function()
require("core.utils").load_mappings "comment"
end,
},
-- file managing , picker etc
["kyazdani42/nvim-tree.lua"] = {
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
config = function()
require "plugins.configs.nvimtree"
end,
setup = function()
require("core.utils").load_mappings "nvimtree"
end,
},
["nvim-telescope/telescope.nvim"] = {
cmd = "Telescope",
config = function()
require "plugins.configs.telescope"
end,
setup = function()
require("core.utils").load_mappings "telescope"
end,
},
-- Only load whichkey after all the gui
["folke/which-key.nvim"] = {
disable = true,
module = "which-key",
keys = { "<leader>", '"', "'", "`" },
config = function()
require "plugins.configs.whichkey"
end,
setup = function()
require("core.utils").load_mappings "whichkey"
end,
},
}
local present, packer = pcall(require, "packer")
if present then
vim.cmd "packadd packer.nvim"
-- Override with default plugins with user ones
plugins = require("core.utils").merge_plugins(plugins)
-- load packer init options
local init_options = require("plugins.configs.others").packer_init()
init_options = require("core.utils").load_override(init_options, "wbthomason/packer.nvim")
packer.init(init_options)
packer.startup { plugins }
end