-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false -- List of all default plugins & their definitions local default_plugins = { "nvim-lua/plenary.nvim", -- nvchad plugins { "NvChad/extensions", branch = "v2.0" }, { "NvChad/base46", branch = "v2.0" }, { "NvChad/ui", branch = "v2.0", lazy = false, config = function() require "nvchad_ui" end, }, { "NvChad/nvterm", init = require("core.utils").load_mappings "nvterm", opts = {}, config = function(_, opts) require "base46.term" require("nvterm").setup(opts) end, }, { "NvChad/nvim-colorizer.lua", init = require("core.utils").lazy_load "nvim-colorizer.lua", config = function() require("colorizer").setup() -- execute colorizer as soon as possible vim.defer_fn(function() require("colorizer").attach_to_buffer(0) end, 0) end, }, { "nvim-tree/nvim-web-devicons", opts = function() return { override = require("nvchad_ui.icons").devicons } end, config = function(_, opts) dofile(vim.g.base46_cache .. "devicons") require("nvim-web-devicons").setup(opts) end, }, { "lukas-reineke/indent-blankline.nvim", init = function() require("core.utils").lazy_load "indent-blankline.nvim" require("core.utils").load_mappings "blankline" end, opts = require("plugins.configs.others").blankline, config = function(_, opts) dofile(vim.g.base46_cache .. "blankline") require("indent_blankline").setup(opts) end, }, { "nvim-treesitter/nvim-treesitter", init = require("core.utils").lazy_load "nvim-treesitter", cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, build = ":TSUpdate", opts = require "plugins.configs.treesitter", config = function(_, opts) require("nvim-treesitter.configs").setup(opts) end, }, -- git stuff { "lewis6991/gitsigns.nvim", ft = "gitcommit", init = 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("lazy").load { plugins = "gitsigns.nvim" } end) end end, }) end, opts = require("plugins.configs.others").gitsigns, config = function(_, opts) dofile(vim.g.base46_cache .. "git") require("gitsigns").setup(opts) end, }, -- lsp stuff { "williamboman/mason.nvim", cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" }, config = function(_, opts) require("mason").setup(opts) -- custom nvchad cmd to install all mason binaries listed vim.api.nvim_create_user_command("MasonInstallAll", function() vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " ")) end, {}) end, }, { "neovim/nvim-lspconfig", init = require("core.utils").lazy_load "nvim-lspconfig", config = function() require "plugins.configs.lspconfig" end, }, -- load luasnips + cmp related in insert mode only { "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { { -- snippet plugin "L3MON4D3/LuaSnip", dependencies = "rafamadriz/friendly-snippets", config = function() require("plugins.configs.others").luasnip() end, }, -- autopairing of (){}[] etc { "windwp/nvim-autopairs", opts = { fast_wrap = {}, disable_filetype = { "TelescopePrompt", "vim" }, }, config = function(_, opts) require("nvim-autopairs").setup(opts) -- setup cmp for autopairs local cmp_autopairs = require "nvim-autopairs.completion.cmp" require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) end, }, -- cmp sources plugins { "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", }, }, opts = function() return require "plugins.configs.cmp" end, config = function(_, opts) require("cmp").setup(opts) end, }, { "numToStr/Comment.nvim", -- keys = { "gc", "gb" }, init = require("core.utils").load_mappings "comment", config = function() require("Comment").setup() end, }, -- file managing , picker etc { "nvim-tree/nvim-tree.lua", cmd = { "NvimTreeToggle", "NvimTreeFocus" }, init = require("core.utils").load_mappings "nvimtree", opts = require "plugins.configs.nvimtree", config = function(_, opts) require("nvim-tree").setup(opts) end, }, { "nvim-telescope/telescope.nvim", cmd = "Telescope", init = require("core.utils").load_mappings "telescope", opts = function() return require "plugins.configs.telescope" end, config = function(_, opts) local telescope = require "telescope" telescope.setup(opts) -- load extensions for _, ext in ipairs(opts.extensions_list) do telescope.load_extension(ext) end end, }, -- Only load whichkey after all the gui { "folke/which-key.nvim", enabled = false, keys = { "", '"', "'", "`" }, init = require("core.utils").load_mappings "whichkey", opts = require "plugins.configs.whichkey", config = function(_, opts) require("which-key").setup(opts) end, }, { import = require("core.utils").load_config().plugins }, } -- load lazy.nvim _,opts local lazy_config = require "plugins.configs.lazy_nvim" require("lazy").setup(default_plugins, lazy_config)