Home

Awesome

heirline-components.nvim

Distro agnostic components for your Neovim heirline config.

screenshot_2024-02-24_01-22-19_324713023

This is how the components above look on the statusline. screenshot_2024-02-24_01-24-08_523136078

<div align="center"> <a href="https://discord.gg/ymcMaSnq7d" rel="nofollow"> <img src="https://img.shields.io/discord/1121138836525813760?color=azure&labelColor=6DC2A4&logo=discord&logoColor=black&label=Join the discord server&style=for-the-badge" data-canonical-src="https://img.shields.io/discord/1121138836525813760"> </a> </div>

Table of contents

Why

Heirline is a engine to create your own Neovim user interface. This comes at a price though: increased complexity. To avoid that problem, I've decided to compile this collection of components you can fork and modify. That way you have a safe and well tested starting point to hopefuly save you a lot of time.

How to install

Add it as a dependency of heirline

{
  "rebelot/heirline.nvim",
  dependencies = { "Zeioth/heirline-components.nvim" }
  opts = {},
    config = function(_, opts)
      local heirline = require "heirline"
      local heirline_components = require "heirline-components.all"

      -- Setup
      heirline_components.init.subscribe_to_events()
      heirline.load_colors(heirline_components.hl.get_colors())
      heirline.setup(opts)
    end,
}

Some extra features will only be available if you have the next plugins installed:

How to use

You can add a component to your heirline config as

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

Normally you will use components directly like in this example. But in some cases you can customize a component. Refer to every specific component for more info.

Example config

You can find the example config we use for NormalNvim here.

Components

Tabline components

This is the heirline line you see at the top of the screen.

ComponentDescription
tabline_buffersTabline component to display the listed buffers of the current tabpage.
tabline_tabpagesTabline component to display the available tabpages.
tabline_conditional_paddingTabine component to add padding under certain conditions. By default it adds padding when you open a side panel like neotree, or aerial, according to the panel width.

You can control the tabline from your keymappings with heirline-components.buffer.

Winbar components

This is the heirline line you see under the tabline.

ComponentDescription
winbar_when_inactiveIf present, it will empty the winbar while the buffer doesn't have the focus (like in the terminal, neotree, etc).
breadcrumbsWinbar component to display a LSP based breadcrumbs section.
compiler_playWinbar component to display a button to open compiler.nvim.
compiler_stopWinbar component to display a button to dispose all compiler.nvim tasks.
compiler_redoWinbar component to display a button to redo the last selected compiler.nvim action.
compiler_build_typeWinbar component to toggle the current build type of your cmake or gradle project on compiler.nvim.
neotreeWinbar component to display a button to toggle neotree.
aerialWinbar component to display a button to toggle aerial.
zen_modeWinbar component to display a button to toggle zen-mode.
write_bufferWinbar component to display a button to write the current buffer.
write_all_buffersWinbar component to display a button to write all loaded buffers.

Statuscolumn components

This is the heirline column you see at the left of the screen.

ComponentDescription
foldcolumnStatuscolumn component to fold/unfold lines.
numbercolumnStatuscolumn component to display the line numbers.
signcolumnStatuscolumn component to indicate the lines that have been changed since the last commit (gitsigns hunks).

Statusline components

This is the heirline line you see at the bottom of the screen.

ComponentDescription
fillStatusline component to fill the empty space of the bar.
file_infoStatusline component to display the filetype of the current buffer.
file_encodingStatusline component to display operative system and file encoding.
navStatusline component to display a nativation area, with line number, and the current navigation %.
cmd_infoStatusline component to display information about some commands, like a macro recording indicator, or the search results.
modeStatusline component for a mode chage. By default it only show colors, but it can be configured to show NORMAL, INSERT... etc like in classic vim.
git_branchStatusline component to display the current git branch.
git_diffStatusline component to display the current git diff (added, removed, changed).
diagnosticsStatusline component to display a diagnostics section (errors, warnings, info).
treesitterStatusline component to display a indicator when Treesitter is enabled.
lspStatusline component to display the loaded lsp clients. Or their current load % if they haven't loaded yet. Similar to the plugin noice.nvim.
virtual_envStatusline component to display the current python virtual env.
compiler_stateStatusline component to display a spinner while compiler.nvim is running. This component is also compatible with overseer.

Available options

You can customize icons and colors in a easy way.

Option
icons
colors

For example:

"rebelot/heirline.nvim",
dependencies = {
  {
    "Zeioth/heirline-components.nvim",
    opts = {
      icons = { DiagnosticError = ";D" }
      colors = nil
    }
  }
}

Events (Optional)

Heirline-components listen for two different events:

EventDescription
ColorSchemeWhen you trigger this event, Heirline-components will reload its colors.
User HeirlineComponentsTablineBuffersUpdatedThis event is automatically triggered every time a buffer is added or deleted from the component tabline_buffers (which is ruled by vim.t.bufs). This is useful if you only want to show the tabline when more that 1 buffer is opened. To do so, you can create a autocmd to listen to this event. Then make it set the vim.opt.showtabline = 2 if #vim.t.bufs > 1.

So if you experience issues with colors or outdated tabline info, trigger these events with :doautocmd.

Credits

Currently, most of the GPL3 lua components this plugin use come from AstroNvim and NormalNvim. So please support both projects if you enjoy this plugin.

FAQ

🌟 Support the project

If you want to help me, please star this repository to increase the visibility of the project.

Stargazers over time