A snazzy 💅 buffer line (with minimal tab integration) for Neovim built using lua.
This plugin shamelessly attempts to emulate the aesthetics of GUI text editors/Doom Emacs. It was inspired by a screenshot of DOOM Emacs using centaur tabs. I don't intend to copy all of it's functionality though.
Status: 🚧 Alpha
- Colours derived from colorscheme where possible, should appear similar in most cases
- Option to show buffer numbers
- Close icons for closing individual buffers
- Modified symbol
- Nightly nvim
- A patched font (see nerd fonts)
Super early days there might be some breaking changes, if you use this without configuring it this shouldn't affect you too much.
Plug 'kyazdani42/nvim-web-devicons' " Recommended (for coloured icons)
" Plug 'ryanoasis/vim-devicons' Icons without colours
Plug 'Akin909/nvim-bufferline.lua'
If using native packages make sure to add this plugins in the /pack/*/opt
directory. This is because plugins in the /start
directory are not loaded until
after your init.vim
is processed which will be too late.
packadd! nvim-bufferline.lua
" then call setup sometime after this
You need to be using termguicolors
for this plugin to work, as it reads the hex gui
color values
of various highlight groups.
set termguicolors
" In your init.vim AFTER loading plugins
lua require'bufferline'.setup()
This plugin relies on some basic highlights being set by your colour scheme
i.e. Normal
, String
, TabLineSel
(WildMenu
as fallback), Comment
.
It's unlikely to work with all colour schemes, which is not something I will fix tbh.
You can either try manually overriding the colours or manually creating these highlight groups
before loading this plugin.
If the contrast in your colour scheme is too high, think an all black colour scheme, this plugin won't create a nice tabline.
- I was looking for an excuse to play with lua and learn to create a plugin with it for Neovim.
- I wanted to add some tweaks to my buffer line and didn't want to figure out a bunch of
vimscript
in some other plugin.
🤷 figured someone else might like the aesthetic. Don't make me regret this...
- Make it snazzy
- Maintain general appearance across various colour schemes. Tested with:
one.vim
night-owl.vim
vim-monokai-tasty
- Show LSP diagnostics in bufferline so it's clear which buffers have errors
- A few different configuration options for file names
- Show only the buffers relevant/open in a specific tab as a configurable setting
- Appeal to every single person's tastes. This plugin is opinionated about how the tabline looks, it's unlikely to please everyone, I don't want to try and support a bunch of different appearances.
- Supporting vim please don't ask. The whole point was to create a lua plugin. If vim ends up supporting lua in the same way then maybe.
- Add every possible feature under the sun ☀, to appease everybody.
- Create and maintain a monolith 😓.
- Highlight file type icons for example
- Expose user configuration
- Fix truncation happening too early i.e. available width reported incorrectly
- Fix modified highlight colouring
- Show tabs
- Handle keeping active buffer always in view
- Show remainder marker as <- or -> depending on where truncation occurred
- Fix current buffer highlight disappearing when inside ignored buffer
- Dynamically set styling to appear consistent across colour schemes
- Buffer label truncation
lua require'bufferline'.setup{
options = {
view = "multiwindow" | "default",
numbers = "none" | "ordinal" | "buffer_id",
number_style = "superscript" | "",
mappings = true | false,
close_icon = "x"
max_name_length = 18,
tab_size = 18,
show_buffer_close_icons = true | false,
separator_style = "thick" | "thin"
enforce_regular_tabs = false | true
}
}
Generally this plugin enforces a minimum tab size so that the buffer line
appears consistent. Where a tab is smaller than the tab size it is padded.
If it is larger than the tab size it is allowed to grow up to the max name
length specified (+ the other indicators).
If you set enforce_regular_tabs = true
tabs will be prevented from extending beyond
the tab size and all tabs will be the same length
Multi-window mode (inspired by vem-tabline
)
When this mode is active, for layouts of multiple windows in the tabpage, only the buffers that are displayed in those windows are listed in the tabline. That only applies to multi-window layouts, if there is only one window in the tabpage, all buffers are listed.
If the mappings
option is set to true
. <leader>
1-9 mappings will
be created to navigate the first to the tenth buffer in the bufferline.
This is false by default. If you'd rather map these yourself, use:
nnoremap mymap :lua require"bufferline".go_to_buffer(num)<CR>
This plugin is designed to work automatically, deriving colours from the user's theme, but if you must...
lua require'bufferline'.setup{
highlights = {
bufferline_tab = {
guifg = comment_fg,
guibg = normal_bg,
};
bufferline_tab_selected = {
guifg = comment_fg,
guibg = tabline_sel_bg,
};
bufferline_buffer = {
guifg = comment_fg,
guibg = custom_bg,
};
bufferline_buffer_inactive = {
guifg = comment_fg,
guibg = normal_bg,
};
bufferline_modified = {
guifg = diff_add_fg,
guibg = "none"
};
bufferline_separator = {
guibg = custom_bg,
};
bufferline_selected = {
guifg = normal_fg,
guibg = normal_bg,
gui = "bold,italic",
};
};
}