From 450e0b88edd001225a1f5520106ebdbb5ff96e89 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 20 Mar 2024 13:29:08 -0600 Subject: Implement diagnostic objects. Follows the pattern: i[nl]d[wei] for next/last diagnostic warning/error/info. --- plugin/diagnostic_objects.vim | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugin/diagnostic_objects.vim (limited to 'plugin') diff --git a/plugin/diagnostic_objects.vim b/plugin/diagnostic_objects.vim new file mode 100644 index 0000000..f2ecf1b --- /dev/null +++ b/plugin/diagnostic_objects.vim @@ -0,0 +1,33 @@ +" Contains object mappings for vim diagnostics. + +" indw: next diagnostic warning +" ildw: last diagnostic warning +" inde: next diagnostic error +" ilde: last diagnostic error +" indi: next diagnostic info +" ildi: last diagnostic info +" inda: next any diagnostic +" ilda: last any diagnostic + +if ! has('nvim') + " Must have neovim for this to work. + finish +endif + +onoremap indw lua require('diagnostic_objects').highlight_matching_diagnostic('next', 2) +onoremap ildw lua require('diagnostic_objects').highlight_matching_diagnostic('last', 2) +onoremap inde lua require('diagnostic_objects').highlight_matching_diagnostic('next', 1) +onoremap ilde lua require('diagnostic_objects').highlight_matching_diagnostic('last', 1) +onoremap indi lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4) +onoremap ildi lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4) +onoremap inda lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1) +onoremap ilda lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1) + +vnoremap indw lua require('diagnostic_objects').highlight_matching_diagnostic('next', 2) +vnoremap ildw lua require('diagnostic_objects').highlight_matching_diagnostic('last', 2) +vnoremap inde lua require('diagnostic_objects').highlight_matching_diagnostic('next', 1) +vnoremap ilde lua require('diagnostic_objects').highlight_matching_diagnostic('last', 1) +vnoremap indi lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4) +vnoremap ildi lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4) +vnoremap inda lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1) +vnoremap ilda lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1) -- cgit