Skip to content

Commit ec911a4

Browse files
committed
Add a delay before printing usage message
Without this, the message is cleared before the UI is fully initialized. This also allows us to use the default INFO log level. Previously, using WARN level was required to make the message display. But now it seems like even WARN level is not enough to keep the message displayed. I'm not a fan of using those `time.sleep()`-type of "fixes". And it's possible that using a 100ms delay is not appropriate for all set ups, but just happens to work for me as of September 4 2025. But I don't have time right now to find a proper fix, let alone investigate and bisect when the behaviour changed in Neovim. This can be replicated with: $ nvim --clean --noplugin -c 'lua vim.notify("hello")' versus $ nvim --clean --noplugin -c 'lua vim.defer_fn(function() vim.notify("hello") end, 100)' The first one doesn't have any message in the `:messages` section, while the latter does (using Neovim v0.11.3).
1 parent 82b4a87 commit ec911a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/jj-diffconflicts/init.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ h.setup_ui = function(conflicts, show_history, show_usage_message)
295295

296296
-- Display usage message
297297
if show_usage_message then
298-
vim.notify(
299-
"Resolve conflicts leftward then save. Use :cq to abort.",
300-
vim.log.levels.WARN
298+
-- We defer printing the message by 100ms, otherwise it is cleared before
299+
-- the UI is fully initialized
300+
vim.defer_fn(
301+
function() vim.notify("Resolve conflicts leftward then save. Use :cq to abort.") end,
302+
100
301303
)
302304
end
303305
end

0 commit comments

Comments
 (0)