jdhao / nvim-config

A modern Neovim configuration with full battery for Python, Lua, C++, Markdown, LaTeX, and more...
MIT License
3.4k stars 502 forks source link

the plugin load events for cmp and nvim-lspconfig need adjustment #230

Closed jdhao closed 12 months ago

jdhao commented 12 months ago

If we use VeryLazy as event for both nvim-cmp and nvim-lspconfig, it seems that the nvim_lsp source for nvim-cmp can not be set properly with a high chance. The following patch can fix this:

diff --git i/lua/plugins.lua w/lua/plugins.lua
index 3cd2004..cd8667c 100644
--- i/lua/plugins.lua
+++ w/lua/plugins.lua
@@ -23,7 +23,7 @@ require("lazy").setup {
   -- auto-completion engine
   {
     "hrsh7th/nvim-cmp",
-    event = 'VeryLazy',
+    event = 'InsertEnter',
     dependencies = {
       "hrsh7th/cmp-nvim-lsp",
       "onsails/lspkind-nvim",
@@ -40,7 +40,7 @@ require("lazy").setup {

   {
     "neovim/nvim-lspconfig",
-    event = 'VeryLazy',
+    event = { 'BufRead', 'BufNewFile' },
     config = function()
       require("config.lsp")
     end,