autoload/lsp/diag.vim | 6 ++++++ plugin/lsp.vim | 2 +- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index bdf36a4223e275d123972b3a81fb6bd2ce224ac3..8e277231dec896c2f7650b71567d0950e1ee23c6 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -517,6 +517,12 @@ JumpDiag(diags[-1]) return endif + # If [count] exceeded the previous diags + if which == 'prev' && a_count > 1 && a_count != count + JumpDiag(diags[0]) + return + endif + if which == 'here' util.WarnMsg('Error: No more diagnostics found on this line') else diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 8d2ea9d9bbd4a510d324312882938e09356f2f0d..12271dd470fca5374f41956004fa6c20091a8688 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -83,7 +83,7 @@ command! -nargs=0 -bar LspDiagFirst lsp.JumpToDiag('first') command! -nargs=0 -bar LspDiagHighlightDisable lsp.DiagHighlightDisable() command! -nargs=0 -bar LspDiagHighlightEnable lsp.DiagHighlightEnable() command! -nargs=0 -bar -count=1 LspDiagNext lsp.JumpToDiag('next', ) -command! -nargs=0 -bar LspDiagPrev lsp.JumpToDiag('prev') +command! -nargs=0 -bar -count=1 LspDiagPrev lsp.JumpToDiag('prev', ) command! -nargs=0 -bar LspDiagShow lsp.ShowDiagnostics() command! -nargs=0 -bar LspDiagHere lsp.JumpToDiag('here') command! -nargs=0 -bar LspFold lsp.FoldDocument()