aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins.lua
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2023-09-01 01:04:04 +0200
committerjdhao <jdhao@hotmail.com>2023-09-01 01:07:16 +0200
commit997c6286dfceaedf3b057c89f8b3d023de7fc1d6 (patch)
treef6c1fa340d920baea48231772445ed764b1d163e /lua/plugins.lua
parent359621b126507f7ff5dbbb017004721a54e6a89d (diff)
Optimize plugin loading speed
Diffstat (limited to 'lua/plugins.lua')
-rw-r--r--lua/plugins.lua47
1 files changed, 25 insertions, 22 deletions
diff --git a/lua/plugins.lua b/lua/plugins.lua
index e728510..3cd2004 100644
--- a/lua/plugins.lua
+++ b/lua/plugins.lua
@@ -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")