harpbar.nvim
A lightweight Neovim plugin that displays an informative, visual tabline for your Harpoon marks with active file highlighting.
harpbar.nvim is a lightweight Neovim plugin that integrates directly with ThePrimeagen’s popular harpoon plugin. It provides a persistent, visual bar at the top of your Neovim window, displaying all your current Harpoon marks with clear highlighting for the actively focused file.
The name is a play on “Harpoon” and “handlebar” — giving you a bar to grip your harpooned files, keeping them always visible and one click away. This UI enhancement makes it significantly easier to visually track, navigate, and manage your marked files without needing to open the Harpoon menu.
Key Features
- Visual Tabline: All Harpoon marks are displayed as a compact tab bar at the top of the Neovim window, styled to blend seamlessly with your colour scheme.
- Active Highlighting: The currently focused file is highlighted distinctly, making it immediately obvious which mark you’re editing.
- Click Navigation: Each tab is clickable — left-click to jump directly to that marked file.
- Dynamic Updates: The tabline refreshes automatically whenever you add, remove, or reorder Harpoon marks, or switch buffers.
- Seamless Integration: Works with
lazy.nvim,packer.nvim, andvim-plug. Designed to compose cleanly alongside other tabline/statusline plugins.
How It Works
harpbar.nvim hooks into two Neovim mechanisms:
- Harpoon’s list API — it reads the current list of marked files from
harpoon:list(), extracting each mark’s filename (shortened to basename for display) and its index. - Neovim’s tabline — it overrides
vim.opt.tablinewith a custom renderer that builds an HL-group-styled string. Each tab is a%#HighlightGroup# filename %#Normal#segment with a divider. The active file’s tab gets a distinct highlight group lifted from the user’s colour scheme.
The plugin sets up autocmds (BufEnter, BufLeave, and harpoon’s own HarpoonChanged event) to trigger re-renders whenever the active buffer or mark list changes, keeping the tabline always in sync.
Installation
-- lazy.nvim
{
"JamieLittle16/harpbar.nvim",
dependencies = { "ThePrimeagen/harpoon" },
config = function()
require("harpbar").setup()
end,
}
-- packer.nvim
use {
"JamieLittle16/harpbar.nvim",
requires = { "ThePrimeagen/harpoon" }
}
-- vim-plug
Plug 'ThePrimeagen/harpoon'
Plug 'JamieLittle16/harpbar.nvim'
It is recommended to disable lazy loading for harpoon:
{ "ThePrimeagen/harpoon", lazy = false }