Skip to content

Clarification about LazyFile event #1583

Closed Answered by folke
dpetka2001 asked this question in Q&A
Discussion options

You must be logged in to vote

It's a shortcut for event = { "BufReadPost", "BufWritePost", "BufNewFile" }, but defers (and re-triggers) the event to make sure the ui isn't blocked for initial rendering.

Previously when you opened a file directly like nvim foo.lua, then Neovim triggers BufReadPost events before VimEnter.
This is annoying, since in our case lsp-config, treesitter and others would block showing the actual file.

The new change renders the file as fast as possible and right after that loads any file-based plugins.
As a consequence, the startuptime of nvim foo.lua will now be similar to just doing nvim.

I mainly added this as an internal event for LazyVim specs, but you're of course free to also use this in…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@folke
Comment options

@dpetka2001
Comment options

@baggiponte
Comment options

@folke
Comment options

@synic
Comment options

Answer selected by dpetka2001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants