diff options
author | Josh Rahm <rahm@google.com> | 2024-03-20 13:29:08 -0600 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2024-03-20 13:29:08 -0600 |
commit | 450e0b88edd001225a1f5520106ebdbb5ff96e89 (patch) | |
tree | 9b72974b4ef22920efcdc688247b7f35298362b4 /plugin/diagnostic_objects.vim | |
parent | 23b6fe0ca1c59b02b761da2ee22ffcf82a0d7991 (diff) | |
download | fieldmarshal.vim-450e0b88edd001225a1f5520106ebdbb5ff96e89.tar.gz fieldmarshal.vim-450e0b88edd001225a1f5520106ebdbb5ff96e89.tar.bz2 fieldmarshal.vim-450e0b88edd001225a1f5520106ebdbb5ff96e89.zip |
Implement diagnostic objects.
Follows the pattern:
i[nl]d[wei] for next/last diagnostic warning/error/info.
Diffstat (limited to 'plugin/diagnostic_objects.vim')
-rw-r--r-- | plugin/diagnostic_objects.vim | 33 |
1 files changed, 33 insertions, 0 deletions
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 <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 2)<cr> +onoremap ildw <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('last', 2)<cr> +onoremap inde <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 1)<cr> +onoremap ilde <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('last', 1)<cr> +onoremap indi <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4)<cr> +onoremap ildi <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4)<cr> +onoremap inda <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1)<cr> +onoremap ilda <cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1)<cr> + +vnoremap indw <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 2)<cr> +vnoremap ildw <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('last', 2)<cr> +vnoremap inde <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 1)<cr> +vnoremap ilde <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('last', 1)<cr> +vnoremap indi <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4)<cr> +vnoremap ildi <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', 4)<cr> +vnoremap inda <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1)<cr> +vnoremap ilda <esc><cmd>lua require('diagnostic_objects').highlight_matching_diagnostic('next', -1)<cr> |