A "buffer and tab" tabline:
- Show buffers and tabs in tabline
- Use same style as lualine by default
- Uses same section and component separators as lualine by default
- Bold buffers that are visible
- Ability to name tabs
- Toggle showing buffers per tabs
- Support nvim-web-devicons
- Works with sessions
Using Packer
use {
'kdheepak/tabline.nvim',
config = function()
require'tabline'.setup {
-- Defaults configuration options
enable = true,
options = {
-- If lualine is installed tabline will use separators configured in lualine by default.
-- These options can be used to override those settings.
section_separators = {'', ''},
component_separators = {'', ''},
max_bufferline_percent = 66, -- set to nil by default, and it uses vim.o.columns * 2/3
show_tabs_always = false, -- this shows tabs only when there are more than one tab or if the first tab is named
show_devicons = true, -- this shows devicons in buffer section
show_bufnr = false, -- this appends [bufnr] to buffer section,
show_filename_only = false, -- shows base filename only instead of relative path in filename
modified_icon = "+ ", -- change the default modified icon
modified_italic = false, -- set to true by default; this determines whether the filename turns italic if modified
show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
}
}
vim.cmd[[
set guioptions-=e " Use showtabline in gui vim
set sessionoptions+=tabpages,globals " store tabpages and globals in session
]]
end,
requires = { { 'hoob3rt/lualine.nvim', opt=true }, {'kyazdani42/nvim-web-devicons', opt = true} }
}
Move to next buffer in the tabline.
Move to previous buffer in the tabline.
Open a new tab with these files.
Toggles whether to show all buffers that are open versus only buffers that are currently visible or bound.
Bind the current tab's buffers to these files.
Clear the binding of current tab's buffers.
Rename current tab's name.
You can customize the behavior of this extension by setting values for any of the following optional parameters.
Show devicons in tabline for each buffer (default = true)
Show bufnr in tabline for each buffer (default = false)
Show only filename instead of shortened full path (default = false)
Show separator after the last buffer or tab (default = false)
Show only tabs instead of tabs + buffers (default = false)
nvim-lualine/lualine.nvim
now has buffers and tabs as components.
If you are not interested in binding buffers to tabs, I'd recommend using those components. They work well in any section.
If you'd still like to use tabline with lualine's tabline instead, you can do the following:
use {
'kdheepak/tabline.nvim',
config = function()
require'tabline'.setup {enable = false}
end,
requires = {'hoob3rt/lualine.nvim', 'kyazdani42/nvim-web-devicons'}
}
require'lualine'.setup {
tabline = {
lualine_a = {},
lualine_b = {},
lualine_c = { require'tabline'.tabline_buffers },
lualine_x = { require'tabline'.tabline_tabs },
lualine_y = {},
lualine_z = {},
},
}
Currently, this works best when the buffers and tabs are in section lualine_c
and lualine_x
respectively.
Support for other sections will be added in the future.