refactor(nvim): improve lazy loading of plugins

This commit is contained in:
Price Hiller 2023-05-08 00:50:16 -05:00
parent 8e598c58ef
commit 475ca08e00
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -19,10 +19,11 @@ local lazy = require("lazy")
lazy.setup({ lazy.setup({
-- Lazy itself -- Lazy itself
{ "folke/lazy.nvim" }, { "folke/lazy.nvim" },
-- Commonly used library -- Commonly used library
{ {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
event = "VeryLazy", lazy = true,
}, },
-- Much nicer ui, integrates cmdheight = 0 wella -- Much nicer ui, integrates cmdheight = 0 wella
@ -63,7 +64,7 @@ lazy.setup({
-- Icons for folders, files, etc. -- Icons for folders, files, etc.
{ {
"kyazdani42/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
event = "VeryLazy", lazy = true,
}, },
-- Statusline. -- Statusline.
@ -169,7 +170,9 @@ lazy.setup({
-- Telescope -- Telescope
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
event = "VeryLazy", cmd = {
"Telescope",
},
dependencies = { dependencies = {
"nvim-telescope/telescope-media-files.nvim", "nvim-telescope/telescope-media-files.nvim",
"nvim-telescope/telescope-file-browser.nvim", "nvim-telescope/telescope-file-browser.nvim",
@ -177,7 +180,7 @@ lazy.setup({
"nvim-telescope/telescope-ui-select.nvim", "nvim-telescope/telescope-ui-select.nvim",
"debugloop/telescope-undo.nvim", "debugloop/telescope-undo.nvim",
{ "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" }, { "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
}, },
config = function() config = function()
require("plugins.configs.telescope-nvim") require("plugins.configs.telescope-nvim")
@ -192,7 +195,6 @@ lazy.setup({
-- File Tree -- File Tree
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
event = "VeryLazy",
branch = "v2.x", branch = "v2.x",
dependencies = { dependencies = {
"kyazdani42/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
@ -208,7 +210,7 @@ lazy.setup({
-- Lspconfig -- Lspconfig
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = "VeryLazy", event = "BufReadPre",
dependencies = { dependencies = {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"folke/neodev.nvim", "folke/neodev.nvim",
@ -287,13 +289,11 @@ lazy.setup({
-- Snippets -- Snippets
{ {
"rafamadriz/friendly-snippets", "L3MON4D3/LuaSnip",
build = "make install_jsregexp",
event = "VeryLazy", event = "VeryLazy",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
dependencies = { dependencies = {
"L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
}, },
}, },
@ -315,6 +315,7 @@ lazy.setup({
"lukas-reineke/cmp-rg", "lukas-reineke/cmp-rg",
"onsails/lspkind.nvim", "onsails/lspkind.nvim",
"f3fora/cmp-spell", "f3fora/cmp-spell",
"L3MON4D3/LuaSnip",
}, },
config = function() config = function()
require("plugins.configs._cmp") require("plugins.configs._cmp")
@ -328,8 +329,8 @@ lazy.setup({
}, },
{ {
"saecki/crates.nvim", "saecki/crates.nvim",
event = "VeryLazy",
dependencies = { { "nvim-lua/plenary.nvim" } }, dependencies = { { "nvim-lua/plenary.nvim" } },
ft = "toml",
config = function() config = function()
require("crates").setup() require("crates").setup()
end, end,
@ -375,7 +376,6 @@ lazy.setup({
-- Code formatting -- Code formatting
{ {
"sbdchd/neoformat", "sbdchd/neoformat",
event = "VeryLazy",
cmd = "Neoformat", cmd = "Neoformat",
config = function() config = function()
require("plugins.configs.neoformat") require("plugins.configs.neoformat")
@ -392,8 +392,8 @@ lazy.setup({
setopt = true, setopt = true,
relculright = false, relculright = false,
segments = { segments = {
{ text = { "%s" }, click = "v:lua.ScSa" }, { text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc }, click = "v:lua.ScLa" }, { text = { builtin.lnumfunc }, click = "v:lua.ScLa" },
{ text = { " ", builtin.foldfunc, " " }, click = "v:lua.ScFa" }, { text = { " ", builtin.foldfunc, " " }, click = "v:lua.ScFa" },
}, },
}) })
@ -473,7 +473,7 @@ lazy.setup({
"AckslD/nvim-neoclip.lua", "AckslD/nvim-neoclip.lua",
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
{ "tami5/sqlite.lua", module = "sqlite" }, { "tami5/sqlite.lua" },
{ "nvim-telescope/telescope.nvim" }, { "nvim-telescope/telescope.nvim" },
}, },
config = function() config = function()
@ -486,7 +486,6 @@ lazy.setup({
-- Markdown Previewer -- Markdown Previewer
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
event = "VeryLazy",
build = "cd app && npm install", build = "cd app && npm install",
init = function() init = function()
vim.g.mkdp_filetypes = { "markdown" } vim.g.mkdp_filetypes = { "markdown" }
@ -507,7 +506,6 @@ lazy.setup({
}, },
}) })
end, end,
event = "VeryLazy",
dependencies = { dependencies = {
"sindrets/diffview.nvim", "sindrets/diffview.nvim",
}, },
@ -523,23 +521,12 @@ lazy.setup({
{ {
"kevinhwang91/nvim-hlslens", "kevinhwang91/nvim-hlslens",
event = "VeryLazy", event = "VeryLazy",
module = "hlslens",
keys = "/",
config = function() config = function()
require("hlslens").setup() require("hlslens").setup()
end, end,
}, },
-- Note Taking -- Note Taking
{
"mickael-menu/zk-nvim",
config = function ()
require("zk").setup({
picker = "telescope"
})
end,
event = "VeryLazy",
},
{ {
"nvim-neorg/neorg", "nvim-neorg/neorg",
build = ":Neorg sync-parsers", build = ":Neorg sync-parsers",
@ -583,7 +570,9 @@ lazy.setup({
-- Generate function/class/etc annotations -- Generate function/class/etc annotations
{ {
"danymat/neogen", "danymat/neogen",
event = "VeryLazy", cmd = {
"Neogen",
},
dependencies = "nvim-treesitter/nvim-treesitter", dependencies = "nvim-treesitter/nvim-treesitter",
config = function() config = function()
require("neogen").setup({ require("neogen").setup({
@ -611,7 +600,6 @@ lazy.setup({
-- Maintain last cursor position in files -- Maintain last cursor position in files
{ {
"ethanholz/nvim-lastplace", "ethanholz/nvim-lastplace",
event = "VeryLazy",
config = function() config = function()
require("nvim-lastplace").setup({ require("nvim-lastplace").setup({
lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
@ -621,9 +609,6 @@ lazy.setup({
end, end,
}, },
-- Diagnose startup time
{ "dstein64/vim-startuptime" },
-- More codeactions -- More codeactions
{ {
"ThePrimeagen/refactoring.nvim", "ThePrimeagen/refactoring.nvim",
@ -640,6 +625,7 @@ lazy.setup({
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
}, },
ft = "http",
config = function() config = function()
local rest_nvim = require("rest-nvim") local rest_nvim = require("rest-nvim")
rest_nvim.setup({ rest_nvim.setup({
@ -686,12 +672,12 @@ lazy.setup({
-- Better list continuation -- Better list continuation
{ {
"gaoDean/autolist.nvim", "gaoDean/autolist.nvim",
event = "VeryLazy",
ft = { ft = {
"markdown", "markdown",
"text", "tex",
"text", "text",
"plaintex", "plaintex",
"norg",
}, },
config = function() config = function()
require("autolist").setup({}) require("autolist").setup({})
@ -741,7 +727,6 @@ lazy.setup({
-- Vim Latex Support -- Vim Latex Support
{ {
"lervag/vimtex", "lervag/vimtex",
event = "VeryLazy",
ft = "tex", ft = "tex",
config = function() config = function()
vim.g.vimtext_view_method = "zathura" vim.g.vimtext_view_method = "zathura"
@ -751,7 +736,6 @@ lazy.setup({
{ {
"akinsho/toggleterm.nvim", "akinsho/toggleterm.nvim",
event = "VeryLazy",
config = function() config = function()
require("toggleterm").setup({ require("toggleterm").setup({
start_in_insert = false, start_in_insert = false,
@ -779,10 +763,12 @@ lazy.setup({
{ {
"krivahtoo/silicon.nvim", "krivahtoo/silicon.nvim",
build = "./install.sh build", build = "./install.sh build",
event = "VeryLazy",
dependencies = { dependencies = {
"kyazdani42/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
}, },
cmd = {
"Silicon",
},
config = function() config = function()
require("silicon").setup({ require("silicon").setup({
font = "FiraCode Nerd Font=20", font = "FiraCode Nerd Font=20",
@ -817,8 +803,8 @@ lazy.setup({
{ cursor = "", texthl = "SmoothCursorTrailMedium" }, { cursor = "", texthl = "SmoothCursorTrailMedium" },
{ cursor = "", texthl = "SmoothCursorTrailMedium" }, { cursor = "", texthl = "SmoothCursorTrailMedium" },
{ cursor = "", texthl = "SmoothCursorTrailSmall" }, { cursor = "", texthl = "SmoothCursorTrailSmall" },
{ cursor = ".", texthl = "SmoothCursorTrailXSmall" }, { cursor = ".", texthl = "SmoothCursorTrailXSmall" },
{ cursor = ".", texthl = "SmoothCursorTrailXSmall" }, { cursor = ".", texthl = "SmoothCursorTrailXSmall" },
}, },
}, },
disabled_filetypes = { "NeogitNotification" }, disabled_filetypes = { "NeogitNotification" },
@ -829,7 +815,6 @@ lazy.setup({
-- Color Picker -- Color Picker
{ {
"uga-rosa/ccc.nvim", "uga-rosa/ccc.nvim",
event = "VeryLazy",
config = function() config = function()
require("plugins.configs.ccc") require("plugins.configs.ccc")
end, end,
@ -860,14 +845,24 @@ lazy.setup({
-- Improved Visuals for Documentation -- Improved Visuals for Documentation
{ {
"lukas-reineke/headlines.nvim", "lukas-reineke/headlines.nvim",
event = "VeryLazy",
config = true, config = true,
ft = {
"markdown",
"norg",
},
}, },
-- Convert numbers between binary, decimal, & hex -- Convert numbers between binary, decimal, & hex
{ {
"skosulor/nibbler", "skosulor/nibbler",
event = "VeryLazy", cmd = {
"NibblerToBin",
"NibblerToHex",
"NibblerToDec",
"NibblerToCArray",
"NibblerHexStringToCArray",
"NibblerToggle",
},
config = function() config = function()
require("nibbler").setup({ require("nibbler").setup({
display_enabled = true, -- Set to false to disable real-time display (default: true) display_enabled = true, -- Set to false to disable real-time display (default: true)