kickstart.nvim icon indicating copy to clipboard operation
kickstart.nvim copied to clipboard

Intro disappears immediately after starting up neovim

Open n4s3 opened this issue 1 year ago • 12 comments

Describe the bug

I got the fresh kickstart installation I haven't changed anything, When i launch neovim the intro screen disappears immediately

To Reproduce

  1. ...

Desktop

  • OS: Arch linux
  • Terminal: Alacritty

Neovim Version

Latest version

n4s3 avatar Feb 28 '24 00:02 n4s3

Hi.

What does "latest version" mean please?

What do you see when you run:

nvim --version

from your terminal?

feoh avatar Feb 28 '24 01:02 feoh

Hi.

What does "latest version" mean please?

What do you see when you run:

nvim --version

from your terminal?

NVIM v0.10.0-dev-2465+ga7788c2e25 Build type: RelWithDebInfo LuaJIT 2.1.1702233742 Run "nvim -V1 -v" for more info

n4s3 avatar Feb 28 '24 09:02 n4s3

OK thanks so you're definitely running a recent enough version.

What happens when you type:

nvim --clean

feoh avatar Feb 28 '24 14:02 feoh

OK thanks so you're definitely running a recent enough version.

What happens when you type:

nvim --clean

it does show the intro

n4s3 avatar Feb 28 '24 14:02 n4s3

OK.

Did you git clone the kickstart.nvim repository?

feoh avatar Feb 28 '24 14:02 feoh

Also what happens if you run:

nvim

and then:

cat  ~/.local/state/nvim/log

feoh avatar Feb 28 '24 14:02 feoh

I can confirm that I also don't see the intro screen, or to be precise, it shows for a split second and then disappears. It doesn't bother me, but I went and commented out a bunch of plugins to narrow down the cause and it seems that if I disable these plugins then the intro is showing again:

  • folke/which-key.nvim
  • nvim-telescope/telescope.nvim
  • folke/todo-comments.nvim

@n4s3 can you try this change just to confirm we're seeing the same:

diff --git a/init.lua b/init.lua
index 0506b3e..1047598 100644
--- a/init.lua
+++ b/init.lua
@@ -272,6 +272,7 @@ require('lazy').setup {
 
   { -- Useful plugin to show you pending keybinds.
     'folke/which-key.nvim',
+    enabled = false,
     event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
     config = function() -- This is the function that runs, AFTER loading
       require('which-key').setup()
@@ -296,6 +297,7 @@ require('lazy').setup {
 
   { -- Fuzzy Finder (files, lsp, etc)
     'nvim-telescope/telescope.nvim',
+    enabled = false,
     event = 'VeryLazy',
     branch = '0.1.x',
     dependencies = {
@@ -738,7 +740,7 @@ require('lazy').setup {
   },
 
   -- Highlight todo, notes, etc in comments
-  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
+  --{ 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
 
   { -- Collection of various small independent plugins/modules
     'echasnovski/mini.nvim',

dam9000 avatar Feb 28 '24 15:02 dam9000

Also what happens if you run:

nvim

and then:

cat  ~/.local/state/nvim/log

Yes I cloned the repo. thats the outupt of the log

ERR 2024-02-23T21:30:50.667 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:50.688 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:51.377 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:51.571 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:51.626 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.230 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.389 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.552 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.710 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.909 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:52.937 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:53.287 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd' .../share/nvim/lazy/which-key.nvim/lua/which-key/layout.lua:97: in function 'trail' .../share/nvim/lazy/which-key.nvim/lua/which-key/layout.lua:212: in function 'layout' ...al/share/nvim/lazy/which-key.nvim/lua/which-key/view.lua:313: in function 'on_keys' ...al/share/nvim/lazy/which-key.nvim/lua/which-key/view.lua:255: in function 'open' ...al/share/nvim/lazy/which-key.nvim/lua/which-key/init.lua:49: in function 'show' [string ":lua"]:1: in main chunk ERR 2024-02-23T21:30:53.379 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-23T21:30:54.695 nvim.26680.0 decor_provider_invoke:47: error in provider treesitter/highlighter:line: Error executing lua: /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: Invalid 'col': out of range stack traceback: [C]: in function 'nvim_buf_set_extmark' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:263: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:214: in function 'on_line_impl' /usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:290: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:284> ERR 2024-02-28T01:19:58.095 nvim.716.0 loop_close:174: uv_loop_close() hang? [--I] signal 0x63ca8d3beaa8 [-AI] async 0x63ca8d3be8f0 [R--] check 0x63ca8dd16d70

n4s3 avatar Feb 28 '24 15:02 n4s3

I can confirm that I also don't see the intro screen, or to be precise, it shows for a split second and then disappears. It doesn't bother me, but I went and commented out a bunch of plugins to narrow down the cause and it seems that if I disable these plugins then the intro is showing again:

* folke/which-key.nvim

* nvim-telescope/telescope.nvim

* folke/todo-comments.nvim

@n4s3 can you try this change just to confirm we're seeing the same:

diff --git a/init.lua b/init.lua
index 0506b3e..1047598 100644
--- a/init.lua
+++ b/init.lua
@@ -272,6 +272,7 @@ require('lazy').setup {
 
   { -- Useful plugin to show you pending keybinds.
     'folke/which-key.nvim',
+    enabled = false,
     event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
     config = function() -- This is the function that runs, AFTER loading
       require('which-key').setup()
@@ -296,6 +297,7 @@ require('lazy').setup {
 
   { -- Fuzzy Finder (files, lsp, etc)
     'nvim-telescope/telescope.nvim',
+    enabled = false,
     event = 'VeryLazy',
     branch = '0.1.x',
     dependencies = {
@@ -738,7 +740,7 @@ require('lazy').setup {
   },
 
   -- Highlight todo, notes, etc in comments
-  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
+  --{ 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
 
   { -- Collection of various small independent plugins/modules
     'echasnovski/mini.nvim',

I tried it nothing changed

n4s3 avatar Feb 28 '24 15:02 n4s3

@n4s3 are you using the plain text mode nvim or any of the gui frontends? (using the gui frontends I also never get the intro but in text mode it shows)

Did the intro show up for you before the kickstart rewrite? You can try by checking out this commit which is the last one before the rewrite:

2024-02-05 7af594f rgarber11 Add Build Step to LuaSnip (#611)

dam9000 avatar Feb 28 '24 16:02 dam9000

Yeah I'm seeing no intro on Mac either.

I suppose this is one of those "Advanced users won't care but new users will" scenarios.

feoh avatar Feb 28 '24 16:02 feoh

@n4s3 are you using the plain text mode nvim or any of the gui frontends? (using the gui frontends I also never get the intro but in text mode it shows)

Did the intro show up for you before the kickstart rewrite? You can try by checking out this commit which is the last one before the rewrite:

2024-02-05 7af594f rgarber11 Add Build Step to LuaSnip (#611)

yes it did

n4s3 avatar Feb 28 '24 20:02 n4s3

I can confirm that I also don't see the intro screen, or to be precise, it shows for a split second and then disappears. It doesn't bother me, but I went and commented out a bunch of plugins to narrow down the cause and it seems that if I disable these plugins then the intro is showing again:

* folke/which-key.nvim

* nvim-telescope/telescope.nvim

* folke/todo-comments.nvim

@n4s3 can you try this change just to confirm we're seeing the same:

diff --git a/init.lua b/init.lua
index 0506b3e..1047598 100644
--- a/init.lua
+++ b/init.lua
@@ -272,6 +272,7 @@ require('lazy').setup {
 
   { -- Useful plugin to show you pending keybinds.
     'folke/which-key.nvim',
+    enabled = false,
     event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
     config = function() -- This is the function that runs, AFTER loading
       require('which-key').setup()
@@ -296,6 +297,7 @@ require('lazy').setup {
 
   { -- Fuzzy Finder (files, lsp, etc)
     'nvim-telescope/telescope.nvim',
+    enabled = false,
     event = 'VeryLazy',
     branch = '0.1.x',
     dependencies = {
@@ -738,7 +740,7 @@ require('lazy').setup {
   },
 
   -- Highlight todo, notes, etc in comments
-  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
+  --{ 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
 
   { -- Collection of various small independent plugins/modules
     'echasnovski/mini.nvim',

It might be todo-comments then, that's the only one in the 3 that I use in my personal non-kickstart config and I started noticing similar things

LunarLambda avatar Feb 29 '24 06:02 LunarLambda

Confirmed on my personal config, it seems to be todo-comments

Closed upstream as wontfix, telling users to defer loading of the plugin in config

https://github.com/folke/todo-comments.nvim/issues/210#issuecomment-1586651694

setting event = VimEnter fixes it in my case, but not in kickstart. It might be an ordering issue?

LunarLambda avatar Feb 29 '24 06:02 LunarLambda

When I change the todo-comments line to:

{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false }},

in init.lua, I still see a vanishing intro screen with the latest kickstart.

Am I doing it wrong somehow?

feoh avatar Feb 29 '24 17:02 feoh

As I said, it fixes it in my config, but not kickstart. Either there are other plugins with similar issues (declaring highlight groups), or it's some kind of load order problem. Unfortunately I don't have the time to dig in deep.

LunarLambda avatar Feb 29 '24 17:02 LunarLambda

which-key and telescope both declare their own highlight groups I believe. That makes sense, they both have their own UIs.

LunarLambda avatar Feb 29 '24 17:02 LunarLambda

I wish there were a way to single step through Neovim as it starts up so we could see which plugin does this first.

feoh avatar Feb 29 '24 18:02 feoh

I think this happens when you tell a plugin to load VeryLazy. I have tried removing it from all plugins and the intro appears again.

warbacon avatar Mar 01 '24 23:03 warbacon

These changes fixed it for me:

diff --git a/init.lua b/init.lua
index fd04574..b4370bb 100644
--- a/init.lua
+++ b/init.lua
@@ -269,7 +269,7 @@ require('lazy').setup {

   { -- Useful plugin to show you pending keybinds.
     'folke/which-key.nvim',
-    event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
+    event = 'VimEnter', -- Sets the loading event to 'VeryLazy'
     config = function() -- This is the function that runs, AFTER loading
       require('which-key').setup()

@@ -294,7 +294,7 @@ require('lazy').setup {

   { -- Fuzzy Finder (files, lsp, etc)
     'nvim-telescope/telescope.nvim',
-    event = 'VeryLazy',
+    event = 'VimEnter',
     branch = '0.1.x',
     dependencies = {
       'nvim-lua/plenary.nvim',
@@ -735,7 +735,7 @@ require('lazy').setup {
   },

   -- Highlight todo, notes, etc in comments
-  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
+  { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },

   { -- Collection of various small independent plugins/modules
     'echasnovski/mini.nvim',

taliraj avatar Mar 02 '24 01:03 taliraj

I can confirm that the above patch fixes the issue for me. @taliraj I would suggest you open a PR with the fix, but note that the comment also needs to be updated (Sets the loading event to 'VimEnter')

But I find it strange that this works because I thought that VeryLazy is triggered after VimEnter, at least that what lazy.nvim says:

VeryLazy: triggered after LazyDone and processing VimEnter auto commands

Perhaps there are details not explained in the above description or there's a bug in the VeryLazy event implementation... who knows.

dam9000 avatar Mar 02 '24 08:03 dam9000

My understanding is that VimEnter happens prior to the first UI draw (see also UIEnter), whereas VeryLazy happens possibly after.

LunarLambda avatar Mar 02 '24 08:03 LunarLambda

Seems like VeryLazy is typically triggered after UIEnter. https://github.com/folke/lazy.nvim/blob/aedcd79811d491b60d0a6577a9c1701063c2a609/lua/lazy/core/util.lua#L145

LunarLambda avatar Mar 02 '24 08:03 LunarLambda

I see this issue has already been raised in https://github.com/folke/lazy.nvim : https://github.com/folke/lazy.nvim/issues/1335 https://github.com/folke/lazy.nvim/issues/1038 both issues closed with no fix.

dam9000 avatar Mar 02 '24 08:03 dam9000

After UIEnter (VeryLazy) there's no way to avoid the problem. Lazy's docs say that VeryLazy should be used for things "not important for initial UI" (= can cause redraws on load). Folke has said repeatedly that there's no way to work around this in Lazy and it's not a bug, Neovim is correct to redraw the UI when highlights/syntax and various other things are changed. Maybe Neovim could be patched however to not dismiss the intro on redraw.

Either way, VimEnter or LazyDone are most likely to work, some people said that UIEnter can also be used and is the latest possible point you can use.

LunarLambda avatar Mar 02 '24 09:03 LunarLambda

@LunarLambda thanks for the explanation, I think I understand now, so any plugin that refreshes the UI needs to be loaded before the UIEnter, if you want to keep the intro screen intact. So the event = 'VimEnter' seems to be a proper fix.

I played around a bit with some debugging so that I can understand better what is going on, this is the order of events (with the VimEnter fix):

User LazyPlugins                                                                                                                    
User LazyDone
VimEnter
config: which-key (VimEnter)
config: todo-comments (event = VimEnter)
config: telescope (event = VimEnter)
UIEnter
User LazyVimStarted
User LazyLoad
User LazyRender
User VeryLazy
User MasonToolsUpdateCompleted

This is the patch I used to log the events:

diff --git a/init.lua b/init.lua
index 3f53732..02ebe89 100644
--- a/init.lua
+++ b/init.lua
@@ -84,6 +84,18 @@ I hope you enjoy your Neovim journey,
 P.S. You can delete this when you're done too. It's your config now! :)
 --]]
 
+evlog = ''
+local done = {}
+vim.api.nvim_create_autocmd({ 'VimEnter', 'UIEnter', 'User' }, {
+  callback = function(ev)
+    evstr = ev.event .. ' ' .. ev.match
+    if not done[evstr] then
+      evlog = evlog .. evstr .. '\n'
+    end
+    done[evstr] = true
+  end,
+})
+
 -- Set <space> as the leader key
 -- See `:help mapleader`
 --  NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
@@ -269,8 +281,10 @@ require('lazy').setup {
 
   { -- Useful plugin to show you pending keybinds.
     'folke/which-key.nvim',
-    event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
+    event = 'VimEnter', -- Sets the loading event to 'VimEnter'
     config = function() -- This is the function that runs, AFTER loading
+      --print('which-key config (event = VimEnter)')
+      evlog = evlog .. 'config: which-key (VimEnter)\n'
       require('which-key').setup()
 
       -- Document existing key chains
@@ -293,7 +307,7 @@ require('lazy').setup {
 
   { -- Fuzzy Finder (files, lsp, etc)
     'nvim-telescope/telescope.nvim',
-    event = 'VeryLazy',
+    event = 'VimEnter',
     branch = '0.1.x',
     dependencies = {
       'nvim-lua/plenary.nvim',
@@ -318,6 +332,7 @@ require('lazy').setup {
       -- { 'nvim-tree/nvim-web-devicons' }
     },
     config = function()
+      evlog = evlog .. 'config: telescope (event = VimEnter)\n'
       -- Telescope is a fuzzy finder that comes with a lot of different things that
       -- it can fuzzy find! It's more than just a "file finder", it can search
       -- many different aspects of Neovim, your workspace, LSP, and more!
@@ -734,7 +749,12 @@ require('lazy').setup {
   },
 
   -- Highlight todo, notes, etc in comments
-  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
+  { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false },
+    event = 'VimEnter',
+    config = function()
+      evlog = evlog .. 'config: todo-comments (event = VimEnter)\n'
+    end,
+  },
 
   { -- Collection of various small independent plugins/modules
     'echasnovski/mini.nvim',

dam9000 avatar Mar 02 '24 09:03 dam9000

Happy I could help out :)

LunarLambda avatar Mar 02 '24 13:03 LunarLambda