Currently I have an autocmd with CursorHold that calls lua vim.lsp.diagnostic.show_line_diagnostics()
. However, since repeating “show_line_diagnostics()” will take me inside of the floating window, it seems that there is a lot of situations where my cursor will end up hijacked and go into the diagnostics floating window.
I have removed some scenarios where that would happen, like going to the next or previous diagnostic using :
map('n', '<leader>ln', '<cmd>lua vim.lsp.diagnostic.goto_next({enable_popup= false})<CR>')
But there are still various scenarios where it can happen. For example, having an error at the end of the line and pressing “l” will take me inside the popup.
Is there any way to prevent navigation into the diagnostics floating window when using such an autocmd? Or perhaps a better way to get the same behavior as the current autocmd, but without the navigation troubles?