-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Autocommand (defined in autocommand) not executed #1184
Comments
Related: #858 |
I can also confirm the issue exists. I ran into this when attempting to port to |
I figured out why the snippet in What
does is create a one-time executed autocommand when the However, lazy.nvim/lua/lazy/core/loader.lua Line 100 in 83493db
lazy is loaded, the FileType event has already been triggered.
I'm unsure if For those who are impacted by this, you can update the For the history of why the restore cursor snippet has diverged from |
Plugin managers may call the equivalent of `:runtime! filetype.lua`, which emits the FileType event. If a specified autocommand on FileType with `++once` is defined after filetype detection is enabled, then the autocommand won't be executed. Moving plugin loading and configuration to the end of `init.lua` aligns more closely to the initialization order specified in `:h initializaiton`. I ran into folke/lazy.nvim#1184 when attempting to port plugin management to `lazy`.
Thanks for looking into it! My workaround for this specific case was to keep using BufReadPost without This means the |
Plugin managers may call the equivalent of `:runtime! filetype.lua`, which emits the FileType event. If a specified autocommand on FileType with `++once` is defined after filetype detection is enabled, then the autocommand won't be executed. Moving plugin loading and configuration to the end of `init.lua` aligns more closely to the initialization order specified in `:h initializaiton`. I ran into folke/lazy.nvim#1184 when attempting to port plugin management to `lazy`.
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.4
Operating system/version
MacOS Ventura 13.6
Describe the bug
Autocommand like:
does not trigger the
FileType
autocmd when opening Neovim.The actual autocmd I was trying to use was the one from
:h restore-cursor
:Steps To Reproduce
nvim -u repro.lua repro.lua
Expected Behavior
Both autocommands get executed.
Repro
The text was updated successfully, but these errors were encountered: