Skip to content

cmd_info component

Zeioth edited this page Apr 3, 2024 · 10 revisions

You can add this component to the statusline section of heirline opts.

require("heirline-components.all").component.cmd_info()

You can see how this component look on the center of the next image: When you search text it will show the number of results. screenshot_2024-02-21_22-19-52_734842388

It will also show a indicator while you are recording a macro screenshot_2024-02-21_22-20-08_694744797

Available providers

These are the available providers for this component and its options.

macro_recording = {
  icon = { kind = "MacroRecording", padding = { right = 1 } },
  condition = condition.is_macro_recording,
  update = {
    "RecordingEnter",
    "RecordingLeave",
    callback = vim.schedule_wrap(function() vim.cmd.redrawstatus() end),
  },
},
search_count = {
  icon = { kind = "Search", padding = { right = 1 } },
  padding = { left = 1 },
  condition = condition.is_hlsearch,
},
showcmd = {
  padding = { left = 1 },
  condition = condition.is_statusline_showcmd,
},
surround = {
  separator = "center",
  color = "cmd_info_bg",
  condition = function()
    return condition.is_hlsearch()
      or condition.is_macro_recording()
      or condition.is_statusline_showcmd()
  end,
},
condition = function() return vim.opt.cmdheight:get() == 0 end,
hl = hl.get_attributes "cmd_info",

For example you could explicitly pass the provider macro_recording to the component to customize its icon.

component.cmd_info({ macro_recording = { icon { kind = "SomeOtherIcon" } } })
Clone this wiki locally