From 997c6286dfceaedf3b057c89f8b3d023de7fc1d6 Mon Sep 17 00:00:00 2001 From: jdhao Date: Fri, 1 Sep 2023 01:04:04 +0200 Subject: [PATCH] Optimize plugin loading speed --- lazy-lock.json | 18 +++++++++--------- lua/plugins.lua | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index e08597d..ccc0735 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,7 @@ "LeaderF": { "branch": "master", "commit": "3ded37f92807d8c6ad831d5af2c4ff22bfd32fc8" }, "asyncrun.vim": { "branch": "master", "commit": "42385d54b8546c163b946fd50eed2103ef7993c9" }, "better-escape.vim": { "branch": "master", "commit": "6b16a45a839727977277f6ab11bded63e9ed86bb" }, - "bufferline.nvim": { "branch": "main", "commit": "417b303328118b6d836ae330142e88771c48a8a3" }, + "bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" }, "catppuccin": { "branch": "main", "commit": "2e3e5ebcdc24ef0d5b14a0a999dbbe7936512c46" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, @@ -11,7 +11,7 @@ "cmp-omni": { "branch": "main", "commit": "9436e6cdd7c5dfa24a99a60d9280b24dbdea3649" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" }, - "dashboard-nvim": { "branch": "master", "commit": "9134d7befd50ff920ede5b0f7d6c3dbb9f7c0ecb" }, + "dashboard-nvim": { "branch": "master", "commit": "e3cf42fce88d5f5900029e03726be12289373611" }, "delimitMate": { "branch": "master", "commit": "537a1da0fa5eeb88640425c37e545af933c56e1b" }, "dressing.nvim": { "branch": "master", "commit": "c7b035de7f91bb6b62b4308f105c56d1a968b8c5" }, "edge": { "branch": "master", "commit": "a4fd4f458331d42677d992f428235c491b2016aa" }, @@ -20,7 +20,7 @@ "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "d8590288417fef2430f85bc8b312fae8b1cf2c40" }, + "gitsigns.nvim": { "branch": "main", "commit": "44adf808ace6cb65a3353bd61fa585a2d8fe0db3" }, "gruvbox-material": { "branch": "master", "commit": "b5f8c6a6c1cda630c53b061b765068a0898d47a3" }, "hop.nvim": { "branch": "master", "commit": "03f0434869f1f38868618198b5f4f2ab6d39aef2" }, "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, @@ -33,17 +33,17 @@ "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, "neoformat": { "branch": "master", "commit": "0c285d7a7c06a6ee88db70871a274797693fce42" }, "nightfox.nvim": { "branch": "main", "commit": "a48f6d9a0273101df76eb25d2f5477baa277f935" }, - "nord.nvim": { "branch": "master", "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" }, + "nord.nvim": { "branch": "master", "commit": "15fbfc38a83980b93e169b32a1bf64757f1e2bf4" }, "nvim-bqf": { "branch": "main", "commit": "c920a55c6153766bd909e474b7feffa9739f07e8" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" }, "nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-tree.lua": { "branch": "master", "commit": "00741206c2df9c4b538055def19b99790f0c95c8" }, - "nvim-treesitter": { "branch": "master", "commit": "08c830f625eb93db9c89c5e946e8eea7111bd568" }, + "nvim-treesitter": { "branch": "master", "commit": "f8c2825220bff70919b527ee68fe44e7b1dae4b2" }, "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, "onedark.nvim": { "branch": "master", "commit": "7bd3558c17045b95c961d28861c1b3bd9bdc992a" }, - "onedarkpro.nvim": { "branch": "main", "commit": "c81dff789f7623c431d1f43cf334237e52bbfd61" }, + "onedarkpro.nvim": { "branch": "main", "commit": "fa861b992471d55f653751f1fea8769ca536a554" }, "open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" }, "plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" }, "rose-pine": { "branch": "main", "commit": "e29002cbee4854a9c8c4b148d8a52fae3176070f" }, @@ -51,7 +51,7 @@ "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" }, "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" }, - "telescope.nvim": { "branch": "master", "commit": "207285ccec21b69996a4d3bcfa59df35d48610e8" }, + "telescope.nvim": { "branch": "master", "commit": "2c1ed33a6f6f2db3b69f5421f6b405eda1b07748" }, "ultisnips": { "branch": "master", "commit": "24a3ebb36687b6d59a19d63173713575b486d739" }, "unicode.vim": { "branch": "master", "commit": "c8aa12b1e2e1b6254885b12bdb239ce6c885fdb1" }, "vim-auto-save": { "branch": "master", "commit": "2e3e54ea4c0fc946c21b0a4ee4c1c295ba736ee8" }, @@ -78,11 +78,11 @@ "vim-tmux": { "branch": "master", "commit": "cfe76281efc29890548cf9eedd42ad51c7a1faf0" }, "vim-toml": { "branch": "main", "commit": "d36caa6b1cf508a4df1c691f915572fc02143258" }, "vim-xkbswitch": { "branch": "master", "commit": "42b55bfec8f6dbd715135ce582a6f769831face1" }, - "vimtex": { "branch": "master", "commit": "534fd725f2475a9083b032e402c7e73b8a3fc6bb" }, + "vimtex": { "branch": "master", "commit": "ad17583ce399b6830b4c2888ef2a12d52c5eb607" }, "vista.vim": { "branch": "master", "commit": "f925e481bba7cd5451fb8bca9a6ecfc2bf1f2858" }, "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }, "whitespace.nvim": { "branch": "master", "commit": "f0fc9e9c4ce3f7d2166e9e5a069b64b9ca4a3f15" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }, - "yanky.nvim": { "branch": "main", "commit": "95c2f006ea6eaed2b2d8b8b4943b8fcf13faf03f" }, + "yanky.nvim": { "branch": "main", "commit": "ef70e4e44095a17ab8611cb6630b727ccee0a271" }, "zen-mode.nvim": { "branch": "main", "commit": "68f554702de63f4b7b6b6d4bcb10178f41a0acc7" } } \ No newline at end of file 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 = { "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")