Is it possible to configure MiniStatusline.config.diagnostic_levels?
#41
-
|
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: 2 comments 2 replies
-
|
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)
endAfter 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.
-
|
Hey there, I'm pretty much interested in switching to mini.statusline, but whatever I do, .. I don't get how to express the configuration in init.lua to support custom sections. I then found this example code here and was like: FINALLY some example to follow! \o/ Just to find out that it still does not answer this one question that bugs me with like every mini plugin I'm using: How do I customize mini things? So, I've read all the docs, and I understand everything, up to that point when I want to write such configuration things in my init.lua. I have the following (Lazy) configuration (that tells me):
require('lazy').setup({
{ 'echasnovski/mini.statusline',
config = function()
vim.api.nvim_set_hl(0, 'MiniStatuslineModeCommand', { ... })
-- ...
require('mini.statusline').setup({
content = {
active = function()
local mode, mode_hl = Ministatusline.section_mode({ trunc_width = 120 }) -- Undefined global Ministatusline here
-- ...
end,
}
})
end,
},
})Please please please someone enlighten me. Thanks! |
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…