1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Optimize plugin loading speed

This commit is contained in:
jdhao
2023-09-01 01:04:04 +02:00
parent 359621b126
commit 997c6286df
2 changed files with 34 additions and 31 deletions

View File

@@ -20,12 +20,13 @@ local firenvim_not_active = function()
end
require("lazy").setup {
{ "onsails/lspkind-nvim", lazy = true },
-- auto-completion engine
{
"hrsh7th/nvim-cmp",
event = 'VeryLazy',
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"onsails/lspkind-nvim",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-omni",
@@ -37,9 +38,9 @@ require("lazy").setup {
end,
},
-- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
{
"neovim/nvim-lspconfig",
event = 'VeryLazy',
config = function()
require("config.lsp")
end,
@@ -53,7 +54,7 @@ require("lazy").setup {
end
return false
end,
event = "BufEnter",
event = "VeryLazy",
build = ":TSUpdate",
config = function()
require("config.treesitter")
@@ -66,7 +67,7 @@ require("lazy").setup {
-- Python-related text object
{ "jeetsukumaran/vim-pythonsense", ft = { "python" } },
{ "machakann/vim-swap", event = "VimEnter" },
{ "machakann/vim-swap", event = "VeryLazy" },
-- IDE for Lisp
-- 'kovisoft/slimv'
@@ -87,7 +88,7 @@ require("lazy").setup {
-- Super fast buffer jump
{
"phaazon/hop.nvim",
event = "VimEnter",
event = "VeryLazy",
config = function()
vim.defer_fn(function()
require("config.nvim_hop")
@@ -137,11 +138,11 @@ require("lazy").setup {
{ "tanvirtin/monokai.nvim" },
{ "marko-cerovac/material.nvim" },
{ "nvim-tree/nvim-web-devicons", event = "VimEnter" },
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
{
"nvim-lualine/lualine.nvim",
event = "VimEnter",
event = "VeryLazy",
cond = firenvim_not_active,
config = function()
require("config.statusline")
@@ -150,7 +151,7 @@ require("lazy").setup {
{
"akinsho/bufferline.nvim",
event = "VimEnter",
event = "VeryLazy",
cond = firenvim_not_active,
config = function()
require("config.bufferline")
@@ -160,7 +161,6 @@ require("lazy").setup {
-- fancy start screen
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
cond = firenvim_not_active,
config = function()
require("config.dashboard-nvim")
@@ -169,19 +169,19 @@ require("lazy").setup {
{
"lukas-reineke/indent-blankline.nvim",
event = "VimEnter",
event = "VeryLazy",
config = function()
require("config.indent-blankline")
end,
},
-- Highlight URLs inside vim
{ "itchyny/vim-highlighturl", event = "VimEnter" },
{ "itchyny/vim-highlighturl", event = "VeryLazy" },
-- notification plugin
{
"rcarriga/nvim-notify",
event = "BufEnter",
event = "VeryLazy",
config = function()
vim.defer_fn(function()
require("config.nvim-notify")
@@ -200,7 +200,7 @@ require("lazy").setup {
return false
end
end,
event = "VimEnter",
event = "VeryLazy",
},
-- Only install these plugins if ctags are installed on the system
@@ -226,7 +226,7 @@ require("lazy").setup {
{ "Raimondi/delimitMate", event = "InsertEnter" },
-- Comment plugin
{ "tpope/vim-commentary", event = "VimEnter" },
{ "tpope/vim-commentary", event = "VeryLazy" },
-- Multiple cursor plugin like Sublime Text?
-- 'mg979/vim-visual-multi'
@@ -243,6 +243,7 @@ require("lazy").setup {
-- Manage your yank history
{
"gbprod/yanky.nvim",
cmd = { "YankyRingHistory" },
config = function()
require("config.yanky")
end,
@@ -252,7 +253,7 @@ require("lazy").setup {
{ "tpope/vim-eunuch", cmd = { "Rename", "Delete" } },
-- Repeat vim motions
{ "tpope/vim-repeat", event = "VimEnter" },
{ "tpope/vim-repeat", event = "VeryLazy" },
{ "nvim-zh/better-escape.vim", event = { "InsertEnter" } },
@@ -360,17 +361,17 @@ require("lazy").setup {
ft = { "markdown" },
},
{ "chrisbra/unicode.vim", event = "VimEnter" },
{ "chrisbra/unicode.vim", event = "VeryLazy" },
-- Additional powerful text object for vim, this plugin should be studied
-- carefully to use its full power
{ "wellle/targets.vim", event = "VimEnter" },
{ "wellle/targets.vim", event = "VeryLazy" },
-- Plugin to manipulate character pairs quickly
{ "machakann/vim-sandwich", event = "VimEnter" },
{ "machakann/vim-sandwich", event = "VeryLazy" },
-- Add indent object for vim (useful for languages like Python)
{ "michaeljsmith/vim-indent-object", event = "VimEnter" },
{ "michaeljsmith/vim-indent-object", event = "VeryLazy" },
-- Only use these plugin on Windows and Mac and when LaTeX is installed
{
@@ -399,7 +400,7 @@ require("lazy").setup {
},
-- Modern matchit implementation
{ "andymass/vim-matchup", event = "VimEnter" },
{ "andymass/vim-matchup", event = "VeryLazy" },
{ "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } },
-- Asynchronous command execution
@@ -454,7 +455,7 @@ require("lazy").setup {
-- showing keybindings
{
"folke/which-key.nvim",
event = "VimEnter",
event = "VeryLazy",
config = function()
vim.defer_fn(function()
require("config.which-key")
@@ -463,11 +464,12 @@ require("lazy").setup {
},
-- show and trim trailing whitespaces
{ "jdhao/whitespace.nvim", event = "VimEnter" },
{ "jdhao/whitespace.nvim", event = "VeryLazy" },
-- file explorer
{
"nvim-tree/nvim-tree.lua",
keys = { "<space>s" },
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("config.nvim-tree")
@@ -477,6 +479,7 @@ require("lazy").setup {
{ "ii14/emmylua-nvim", ft = "lua" },
{
"j-hui/fidget.nvim",
event = 'VeryLazy',
tag = "legacy",
config = function()
require("config.fidget-nvim")