The goal of clangwarningparser.nvim is to make it easier to handle clang-tidy output files by parsing each arguments' contents and putting them in a list, also providing previews and jump-to-location.
Using packer:
use {'strptrk/clangwarningparser.nvim'}You have to enable termguicolors to have proper coloring.
Vim:
set termguicolorsLua:
vim.o.termguicolors = trueThe setup function takes a configuration table as an argument, or optionally nothing.
require('clangwarningparser').setup()Default settings:
require('clangwarningparser').setup({
float_opts = {
width_percentage = 75,
height_percentage = 75,
border = 'rounded'
},
relative = true,
width = 20,
open_on_load = true,
center_on_select = false,
strict_bufname = true,
root = "",
root_env = "",
root_cd = false,
map_defaults = true,
keymaps = {
preview = {'o', 'p'},
select_entry = '<CR>',
toggle_win = '<leader>w',
open_win = '<leader>Wo',
close_win = '<leader>Wc',
quit_preview = 'q',
toggle_done = {'d', '<tab>'}
},
colors = {
done = "#05a623",
preview_filepath = "#51D8FF",
select_entry = "#93ccfa",
},
})Options:
-
float_opts: options to control appearance of the preview windowwidth_percentage: width of the preview window relative to the editor size (1-100)height_percentage: height of the preview window relative to the editor size (1-100)border: border style of the preview window- possible values: 'none', 'single', 'double', 'rounded', 'solid', 'shadow'
-
relativeandwidth:- if
relativeistrue, then thewidthvalue is a percentage, relative to the editor size, - if
relativeisfalse, thenwidthrepresents the number of columns.
- if
-
open_on_load: open the sidebar when callingCWParse(true/false) -
center_on_select: center the source code window when selecting the entry in the sidebar (true/false) (executesnorm zz) -
strict_bufname: only parse files ending with.logwhen callingCWParse buffers(true/false) -
root: the project root directory -
root_env: the environmental variable which stores the project root directory -
root_cd::cdinto therootorroot_envdirectory when jumping to files (true/false)- note:
roottakes precedence overroot_env, if neither is given, the root will be set to $PWD
- note:
-
map_defaults: set default keymaps to functions you do not map (true/false) -
keymaps: each keymap is either a string or a table of stringspreview: opens the description of the error in a floating windowselect_entry: jumps to the location of the warning in your original windowtoggle_win: toggles the sidebaropen_win: opens the sidebarclose_win: closes the sidebarquit_preview: quits the floating preview windowtoggle_done: marks currently selected entry as done or undone (by setting the foreground color)
-
colors: the colors used by the plugindone: the foreground color used to mark entries donepreview_filepath: the path's color in the floating preview windowselect_entry: the foreground color of the currently hovered entry in the sidebar (background is theCursorLinehighlight)
Calling the setup function defines the command CWParse
CWParseto parse the current buffer as a clang-tidy output fileCWParse file1 file2 ...to parse the argument files as a clang-tidy output filesCWParse buffersto parse the currently opened buffers as clang-tidy output files
The configured keymaps will only be set after calling CWParse.
Example:
require('clangwarningparser').setup({
float_opts = {
width_percentage = 90,
height_percentage = 75,
border = 'rounded'
},
open_on_load = true,
center_on_select = true,
root = '/home/user/my_project',
map_defaults = false,
keymaps = {
preview = 'o',
select_entry = '<CR>',
toggle_win = '<leader>w',
quit_preview = 'q',
toggle_done = {'d', '<tab>'}
},
})
vim.keymap.set('n', '<leader>w', '<cmd>CWParse buffers<cr>')