A plugin which must be used in conjunction with lualine. This displays buffers with visual separators, and allows pinning support, diagnostic indicators, git status, and smart scrolling.
2025-06-21.11-55-12.mp4
- Buffer Pinning: Pin frequently used buffers to keep them at the front
- Visual Separators: Beautiful separators with dynamic highlighting
- Diagnostic Integration: Shows buffer diagnostics with color coding
- Git Status: Displays git changes (works with gitsigns.nvim)
- Smart Scrolling: Shows limited buffers with scroll indicators
- Clickable Buffers: Click to switch between buffers
- Position-based Navigation: Navigate buffers by visual position
- Buffer Management: Delete buffers to left/right with keymaps
- Modified Indicators: Visual indication of unsaved changes
Using lazy.nvim
{
name = "luabuff",
dir = vim.fn.stdpath("config") .. "/lua/luabuff",
lazy = false,
priority = 1000,
config = function()
require("luabuff").setup({
max_visible_buffers = 6,
active_separators = "",
inactive_separators = "╲",
pin_icon = "📌",
modified_icon = "●",
})
end,
}require("luabuff").setup({
max_visible_buffers = 6, -- Maximum number of buffers to show at once
active_separators = "", -- Separator for active buffer (powerline style)
inactive_separators = "╲", -- Separator for inactive buffers
pinned_key = "LuaBuffPinnedBuffers", -- vim.g key for storing pinned buffers
pin_icon = "📌", -- Icon shown for pinned buffers
modified_icon = "●", -- Icon shown for modified buffers
updatetime = 1000, -- Update frequency in milliseconds
})| Option | Type | Default | Description |
|---|---|---|---|
max_visible_buffers |
number | 6 |
Maximum buffers shown before scrolling |
active_separators |
string | "" |
Separator character(s) for active buffer |
inactive_separators |
string | "╲" |
Separator character(s) for inactive buffers |
pinned_key |
string | "LuaBuffPinnedBuffers" |
Key for storing pinned buffer state |
pin_icon |
string | "📌" |
Icon displayed next to pinned buffers |
modified_icon |
string | "●" |
Icon displayed next to modified buffers |
updatetime |
number | 1000 |
Cache refresh interval in milliseconds |
Add luabuff to your lualine configuration:
require('lualine').setup({
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {
{
function()
return require('luabuff').get_buffers()
end,
separator = '',
}
},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
})The plugin automatically sets up the following keymaps:
| Keymap | Action | Description |
|---|---|---|
<M-s> |
Previous buffer | Navigate to previous buffer by position |
<M-f> |
Next buffer | Navigate to next buffer by position |
<A-1> to <A-6> |
Go to buffer 1-6 | Jump directly to buffer at position |
<leader>bp |
Toggle pin | Pin/unpin current buffer |
<leader>bl |
Delete left | Delete all buffers to the left |
<leader>br |
Delete right | Delete all buffers to the right |
You can disable automatic keymaps and set your own:
-- Access functions directly
vim.keymap.set('n', '<your-key>', function()
require('luabuff').goto_next_buffer()
end, { desc = 'Next buffer' })
vim.keymap.set('n', '<your-key>', function()
require('luabuff').toggle_pin_current()
end, { desc = 'Toggle pin buffer' })| Function | Description |
|---|---|
get_buffers() |
Returns formatted buffer string for lualine |
goto_next_buffer() |
Navigate to next buffer by position |
goto_previous_buffer() |
Navigate to previous buffer by position |
toggle_pin_current() |
Toggle pin status of current buffer |
get_buffer_by_position(pos) |
Get buffer number at specific position |
switch_to_buffer_by_position(pos) |
Switch to buffer at position (used for clicks) |
luabuff uses the following highlight groups that you can customize:
lualine_buffer_normal- Active bufferlualine_buffer_inactive- Inactive bufferLualineBufferVisible- Buffer visible in a windowLualineBufferPinned- Pinned bufferLualineBufferActivePinned- Active pinned buffer
LualineBufferError/LualineBufferActiveErrorLualineBufferWarn/LualineBufferActiveWarnLualineBufferInfo/LualineBufferActiveInfoLualineBufferHint/LualineBufferActiveHint
LualineBufferGitAdded/LualineBufferActiveGitAddedLualineBufferGitChanged/LualineBufferActiveGitChangedLualineBufferGitDeleted/LualineBufferActiveGitDeleted
LualineBufferSeparator- Inactive buffer separatorsLualineBufferScrollIndicator- Scroll indicators
The plugin automatically filters buffers to show only listed and valid buffers. Pinned buffers always appear first in the order.
Inspired by akinsho/bufferline.nvim - Thanks for the excellent buffer management concepts and design patterns that helped shape this plugin.