Enabling the Tabline
To enable the tabline, set thetabline option to true in your Harpoon setup:
- Set
showtablineto2(always show) - Display all your marked files with their index numbers
- Highlight the currently active mark
- Update automatically when marks change
Customizing the Display
Prefix and Suffix
You can customize the spacing around each mark usingtabline_prefix and tabline_suffix:
Highlight Groups
The tabline uses four highlight groups that you can customize to match your theme:| Highlight Group | Purpose |
|---|---|
HarpoonActive | The filename text of the currently active mark |
HarpoonInactive | The filename text of inactive marks |
HarpoonNumberActive | The index number of the currently active mark |
HarpoonNumberInactive | The index numbers of inactive marks |
Default Behavior
By default, if you haven’t customized these highlight groups, Harpoon will link them to your theme’s standard tabline highlights:HarpoonInactive→TablineHarpoonActive→TablineSelHarpoonNumberActive→TablineSelHarpoonNumberInactive→Tabline
The highlight groups are automatically updated when you change your colorscheme, ensuring the tabline always integrates with your theme.
Custom Styling
Here’s an example of creating a clean, minimal tabline appearance:- Removes backgrounds for a transparent look
- Uses muted colors for inactive marks
- Makes active marks stand out in white
- Colors all numbers in blue (
#7aa2f7)
Place highlight commands after your colorscheme is loaded to prevent them from being overridden.
How It Works
The tabline implementation:- Shortens filenames: If multiple marks have unique basenames, only the basename is shown. If there are conflicts, the full relative path is displayed.
- Shows mark indices: Each mark is prefixed with its index number (1, 2, 3, etc.).
- Highlights active mark: The currently open file’s mark is highlighted differently.
- Auto-updates: The tabline refreshes automatically when marks change.
Troubleshooting
Tabline Not Appearing
If the tabline isn’t showing:- Verify
tabline = trueis in your configuration - Check that you don’t have another plugin overriding the tabline
- Ensure you have at least one mark added
Highlights Not Working
If custom highlights aren’t appearing:- Make sure highlight commands run after your colorscheme loads
- Use an autocommand to reapply highlights when changing colorschemes: