We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 09fa1d2 commit 8d11a2aCopy full SHA for 8d11a2a
lua/oil/mutator/init.lua
@@ -553,10 +553,13 @@ M.try_write_changes = function(confirm, cb)
553
{ all_errors[curbuf][1].lnum + 1, all_errors[curbuf][1].col }
554
)
555
else
556
- ---@diagnostic disable-next-line: param-type-mismatch
557
- local bufnr, errs = next(pairs(all_errors))
558
- vim.api.nvim_win_set_buf(0, bufnr)
559
- pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
+ local bufnr, errs = next(all_errors)
+ -- HACK: This is a workaround for the fact that we can't switch buffers in the middle of a
+ -- BufWriteCmd.
+ vim.schedule(function()
560
+ vim.api.nvim_win_set_buf(0, bufnr)
561
+ pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
562
+ end)
563
end
564
unlock()
565
cb("Error parsing oil buffers")
0 commit comments