-
Notifications
You must be signed in to change notification settings - Fork 4
mode component
Zeioth edited this page Apr 3, 2024
·
7 revisions
You can add this component to the statusline section of heirline opts.
require("heirline-components.all").component.mode()
You can see how this component look on the extremes of the next image: It will show blue for normal mode, green for insert mode... etc.
If you prefer the look of classic vim, you can add it like:
require("heirline-components.core").component.mode({ mode_text = {} }) -- on the left side
require("heirline-components.core").component.mode({ mode_text = {}, surround = { separator = "right" } }) -- on the right side
These are the available providers for this component and its options.
mode_text = { pad_text = "center" } -- if set, displays text.
paste = { str = "", icon = { kind = "Paste" }, show_empty = true } -- if set, displays if paste is enabled.
spell = { str = "", icon = { kind = "Spellcheck" }, show_empty = true } -- if set, displays if spellcheck is on.
surround = {
separator = "left", -- where to add the separator.
color = hl.mode_bg, -- you can set a custom background color, for example "#444444".
update = { "ModeChanged", pattern = "*:*" } }, -- events that make the surround provider refresh.
hl = hl.get_attributes "mode", -- you can specify your own highlight group here.
update = {
"ModeChanged", -- events that make this component refresh.
pattern = "*:*",
callback = vim.schedule_wrap(function() vim.cmd.redrawstatus() end),
},
For example to use the component mode
with the provider mode_text
and its option pad_text
you could do:
component.mode({ mode_text = { pad_text = "right" } })
To align the text displayed by the component mode to the right.
We don't enable mode_text
by default default because it fits better on smartphone devices.