https://github.com/pathmann/tabline-labels.nvim
Neovim plugin to customize tab labels with smart path shrinking, minimal and fully configurable
https://github.com/pathmann/tabline-labels.nvim
lua neovim neovim-plugin nvim
Last synced: 10 months ago
JSON representation
Neovim plugin to customize tab labels with smart path shrinking, minimal and fully configurable
- Host: GitHub
- URL: https://github.com/pathmann/tabline-labels.nvim
- Owner: pathmann
- License: mit
- Created: 2025-06-04T07:57:28.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-04T12:18:35.000Z (10 months ago)
- Last Synced: 2025-06-04T19:47:16.584Z (10 months ago)
- Topics: lua, neovim, neovim-plugin, nvim
- Language: Lua
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tabline-labels.nvim
> 🏷️ A simple, customizable plugin to control how tab labels are displayed in Neovim's native tabline.
---
## ✨ Features
- Customize how file paths appear in tab labels
- Optionally strip the current working directory from paths
- Shrink intermediate path segments (e.g. `~/P/s/t/s/s/main.cpp`)
- Fully extensible render logic via user-defined functions
- Lightweight and Lua-native — no dependencies
---
## 📦 Installation
Using [lazy.nvim](https://github.com/folke/lazy.nvim):
```lua
{
"pathmann/tabline-labels.nvim",
config = function()
require("tabline-labels").setup()
end
}
```
---
## ⚙️ Configuration
```lua
require("tabline-labels").setup({
remove_cwd = true, -- Remove the current working directory prefix from paths
-- Customize which path sections get shrinked
should_shrink_section = function(index, total)
-- shrink all but the final path part
return index ~= total
end,
-- Optional: override how each tab is rendered
-- render = function(opts) return "..." end
-- Optional: override the entire tabline rendering
-- render_full = function() return "..." end
})
```
---
## 🔌 Advanced Usage
You can override the render function per-tab like this:
```lua
render = function(opts)
return vim.fn.fnamemodify(opts.bufname, ":t") -- just the filename
end
```
Or override the full render logic:
```lua
render_full = function()
return "%#TabLineSel# My Custom Tabline %#TabLineFill#"
end
```
---
## 💡 Why?
Neovim's default tabline shows the full path to each file, which can become cluttered. This plugin makes it easier to:
- See the file name and context (e.g. last directory)
- Avoid overly long or unreadable tab titles
- Customize your tabline without needing to replace it entirely with bufferline-like plugins
---
## ✅ Requirements
- Neovim 0.7+
- A tabline setup using native tabs (not buffers)
---
## 📄 License
MIT