migrate to lazy.nvim

This commit is contained in:
siduck 2023-01-07 13:41:43 +05:30
parent 5db2f0978d
commit 1b8eff7516
11 changed files with 176 additions and 244 deletions

View file

@ -0,0 +1,70 @@
return {
defaults = {
lazy = true,
},
install = {
-- try to load one of these colorschemes when starting an installation during startup
colorscheme = { "nvchad" },
},
ui = {
icons = {
cmd = "",
config = "",
event = "",
ft = "",
init = "",
import = "",
keys = "",
lazy = "",
loaded = "",
not_loaded = "",
plugin = "",
runtime = "",
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View file

@ -4,14 +4,7 @@ if not present then
return
end
vim.api.nvim_create_augroup("_mason", { clear = true })
vim.api.nvim_create_autocmd("Filetype", {
pattern = "mason",
callback = function()
loadfile(vim.g.base46_cache .. "mason")()
end,
group = "_mason",
})
loadfile(vim.g.base46_cache .. "mason")()
local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim

View file

@ -37,7 +37,7 @@ M.blankline = function()
filetype_exclude = {
"help",
"terminal",
"packer",
"lazy",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
@ -76,6 +76,7 @@ M.colorizer = function()
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = "background", -- Set the display mode.
tailwind = true, -- Enable tailwind colors
},
}
@ -168,22 +169,4 @@ M.devicons = function()
end
end
M.packer_init = function()
return {
auto_clean = true,
compile_on_sync = true,
git = { clone_timeout = 6000 },
display = {
working_sym = "",
error_sym = "",
done_sym = "",
removed_sym = "",
moved_sym = "",
open_fn = function()
return require("packer.util").float { border = "single" }
end,
},
}
end
return M

View file

@ -1,64 +1,40 @@
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
-- List of all default plugins & their definitions
local plugins = {
["nvim-lua/plenary.nvim"] = { module = "plenary" },
["nvim-lua/plenary.nvim"] = {},
["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"] = { branch = "dev", module = { "telescope", "nvchad" } },
["NvChad/extensions"] = { branch = "lazy" },
["NvChad/base46"] = {
module = "base46",
branch = "dev",
branch = "lazy",
},
["NvChad/ui"] = {
branch = "dev",
branch = "lazy",
lazy = false,
config = function()
pcall(require, "nvchad_ui")
require "nvchad_ui"
end,
},
["NvChad/nvterm"] = {
module = "nvterm",
config = function()
require "plugins.configs.nvterm"
end,
setup = function()
init = 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()
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
require("core.utils").load_mappings "blankline"
end,
@ -68,8 +44,7 @@ local plugins = {
},
["NvChad/nvim-colorizer.lua"] = {
opt = true,
setup = function()
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function()
@ -78,12 +53,10 @@ local plugins = {
},
["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter",
setup = function()
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" },
run = ":TSUpdate",
config = function()
require "plugins.configs.treesitter"
@ -93,7 +66,7 @@ local plugins = {
-- git stuff
["lewis6991/gitsigns.nvim"] = {
ft = "gitcommit",
setup = function()
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 }),
@ -102,7 +75,7 @@ local plugins = {
if vim.v.shell_error == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("packer").loader "gitsigns.nvim"
require("lazy").load { plugins = "gitsigns.nvim" }
end)
end
end,
@ -122,8 +95,7 @@ local plugins = {
},
["neovim/nvim-lspconfig"] = {
opt = true,
setup = function()
init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
@ -132,46 +104,47 @@ local plugins = {
},
-- load luasnips + cmp related in insert mode only
["rafamadriz/friendly-snippets"] = { },
["hrsh7th/nvim-cmp"] = {
module = { "cmp", "cmp_nvim_lsp" },
event = { "InsertEnter", "CmdlineEnter" }, -- for users that may use nvim-cmp-cmdline
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",
config = function()
require("plugins.configs.others").autopairs()
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
config = function()
require "plugins.configs.cmp"
end,
},
["L3MON4D3/LuaSnip"] = {
requires = "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" },
-- keys = { "gc", "gb" },
config = function()
require("plugins.configs.others").comment()
end,
setup = function()
init = function()
require("core.utils").load_mappings "comment"
end,
},
@ -182,7 +155,7 @@ local plugins = {
config = function()
require "plugins.configs.nvimtree"
end,
setup = function()
init = function()
require("core.utils").load_mappings "nvimtree"
end,
},
@ -192,35 +165,28 @@ local plugins = {
config = function()
require "plugins.configs.telescope"
end,
setup = function()
init = function()
require("core.utils").load_mappings "telescope"
end,
},
-- Only load whichkey after all the gui
["folke/which-key.nvim"] = {
disable = true,
module = "which-key",
enabled = false,
keys = { "<leader>", '"', "'", "`" },
config = function()
require "plugins.configs.whichkey"
end,
setup = function()
init = function()
require("core.utils").load_mappings "whichkey"
end,
},
}
local present, packer = pcall(require, "packer")
plugins = require("core.utils").merge_plugins(plugins)
if present then
-- Override with default plugins with user ones
plugins = require("core.utils").merge_plugins(plugins)
-- load lazy.nvim options
local lazy_config = require "plugins.configs.lazy_nvim"
lazy_config = require("core.utils").load_override(lazy_config, "folke/lazy.nvim")
-- 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
require("lazy").setup(plugins, lazy_config)