Is it possible to configure MiniStatusline.config.diagnostic_levels
?
#41
-
mini.nvim/lua/mini/statusline.lua Line 470 in c77359a This line makes me think "no", but I started using Also, thank you so so much for letting me replace ~100 lines of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Not at the moment, no. Not really because of that line (which is actually redundant, so thank you for pointing this out :) ). I'll think for a while about adding this here somehow, as it seems like a reasonable usage. But currently I can't see a good way of doing this that is better than custom minimal section function. Here is my version for Neovim 0.6+ (add it before call to local diagnostic_level = function(level, prefix)
if MiniStatusline.is_truncated(75) then
return ''
end
local n = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity[level] })
return (n == 0) and '' or ('%s%s'):format(prefix, n)
end After that it can be used something like this: require('mini.statusline').setup({
content = {
active = function()
-- ...
local errors = diagnostic_level('ERROR', 'E')
local warns = diagnostic_level('WARN', 'W')
local hints = diagnostic_level('HINT', 'H')
-- ...
return MiniStatusline.combine_groups({
-- ...
{ hl = 'DiagnosticError', strings = { errors } },
{ hl = 'DiagnosticWarn', strings = { warns } },
{ hl = 'DiagnosticHint', strings = { hints } },
-- ...
end,
},
}) Edit: Oh, and thank you for kind words. |
Beta Was this translation helpful? Give feedback.
Not at the moment, no. Not really because of that line (which is actually redundant, so thank you for pointing this out :) ).
I'll think for a while about adding this here somehow, as it seems like a reasonable usage. But currently I can't see a good way of doing this that is better than custom minimal section function. Here is my version for Neovim 0.6+ (add it before call to
require('mini.statusline').setup()
):After that it can be used s…