Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 321df84

Browse files
committed
chore(init.lua): do not invoke DoomStarted while PackerSync is running
When running doom for the first time (or after ~/.local/share/nvim/site is cleaned) doom will bootstrap itself by calling packer.sync(). However that happens asynchronously, so do not call DoomStarted in this case: doom is not ready yet. This will allow to safely run the following command to synchronize doom config with packages: ``` nvim --headless --cmd "autocmd User PackerComplete quitall" --cmd "autocmd User DoomStarted PackerSync" ``` Previously such a command wouldn't have been safe on initial run due to the implicit packer.sync: 2 packer syncs running at the same time would show a lot of lua module errors about modules not found, it is best avoided. On subsequent runs it would've been safe but it is useful to have a single command to run that is always safe. This should also make it possible to use a similar command in a CI to wait for the installation of packages and then test that the doom config works. Signed-off-by: Edwin Török <edwin@etorok.net>
1 parent 46940e6 commit 321df84

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/doom/core/init.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ modules.try_sync()
7171
profiler.stop("framework|doom.core.modules")
7272

7373
-- Execute autocommand for user to hook custom config into
74-
vim.api.nvim_exec_autocmds("User", {
75-
pattern = "DoomStarted",
76-
})
74+
if not modules._needs_sync then
75+
vim.api.nvim_exec_autocmds("User", {
76+
pattern = "DoomStarted",
77+
})
78+
end
7779

7880
-- vim: fdm=marker

0 commit comments

Comments
 (0)