Skip to content

Is it possible to configure MiniStatusline.config.diagnostic_levels? #41

Answered by echasnovski
HoldenLucas asked this question in Q&A
Discussion options

You must be logged in to vote

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()):

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 s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HoldenLucas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants