aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/diagnostic.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 1b61cf8f71..62997924d9 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -869,7 +869,16 @@ local function set_list(loclist, opts)
})
end
if open then
- api.nvim_command(loclist and 'lwindow' or 'botright cwindow')
+ if loclist then
+ api.nvim_command('lwindow')
+ else
+ -- First navigate to the diagnostics quickfix list.
+ local nr = vim.fn.getqflist({ id = _qf_id, nr = 0 }).nr
+ api.nvim_command(nr .. 'chistory')
+
+ -- Now open the quickfix list.
+ api.nvim_command('botright cwindow')
+ end
end
end