mini.statusline: How to Enable icons for Warning, Error, Hint, etc. ? #1177
-
To avoid repeating myself, I will link my Reddit post on Neovim sub: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Customizing statusline content is expected by creating a function and setting it to local my_active_content = function()
-- Your code goes here
end
require('mini.statusline').setup({ content = { active = my_active_content } }) Here is an example function used for default content. Copy paste it as As you pointed in Reddit post, indeed using local diag_signs = { ERROR = '!', WARN = '?', INFO = '@', HINT = '*' }
local my_active_content = function()
-- ...
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75, signs = diag_signs })
-- ...
end Adding colors is a bit tricky (which is more or less by design because 'mini.statusline' and 'mini.tabline' are intentionally "colorless"), but doable. The return string of active content is essentially used as 'statusline' value, so any special statusline items (see This can be utilized by setting more complicated diagnostic signs. For example, like so: local diag_signs = {
ERROR = '%#DiagnosticError#!%#MiniStatuslineDevinfo#',
WARN = '%#DiagnosticWarn#?%#MiniStatuslineDevinfo#',
INFO = '%#DiagnosticInfo#@%#MiniStatuslineDevinfo#',
HINT = '%#DiagnosticHint#*%#MiniStatuslineDevinfo#',
}
-- ... The Hope this helps. |
Beta Was this translation helpful? Give feedback.
Customizing statusline content is expected by creating a function and setting it to
config.content.active
. Like this:Here is an example function used for default content. Copy paste it as
my_active_content
body as a start and tweak it until you have your final result.As you pointed in Reddit post, indeed using
signs
argument inMiniStatusline.section_diagnostics()
is the suggested way to customize its signs. So it will be something like this: