Skip to content

Commit 3ab8e87

Browse files
Danilo Verde RibeiroDanilo Verde Ribeiro
authored andcommitted
fix(autocmd): best to fetch context when user is idle
1 parent d76b16c commit 3ab8e87

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lua/opencode/ui/autocmds.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function M.setup_autocmds(windows)
99
input_window.setup_autocmds(windows, group)
1010
output_window.setup_autocmds(windows, group)
1111

12-
-- Only keep shared autocmds here (e.g., WinClosed, WinLeave for all windows)
12+
-- Only keep shared autocmds here (e.g., WinClosed, CursorHold for all windows)
1313
local wins = { windows.input_win, windows.output_win, windows.footer_win }
1414
vim.api.nvim_create_autocmd('WinClosed', {
1515
group = group,
@@ -24,7 +24,8 @@ function M.setup_autocmds(windows)
2424
end,
2525
})
2626

27-
vim.api.nvim_create_autocmd('WinLeave', {
27+
-- Based on CursorHold, update context if user is not focused on opencode window
28+
vim.api.nvim_create_autocmd('CursorHold', {
2829
group = group,
2930
pattern = '*',
3031
callback = function()

0 commit comments

Comments
 (0)