nanozuki / tabby.nvim Goto Github PK
View Code? Open in Web Editor NEWA declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
License: MIT License
A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
License: MIT License
Notice that when I toggled between tabs 1 and 2, the position of 1
and 2
changed. I think the culprit is that when the length of the current buffername changed, the spacer
seems to still add the same number of spaces. In the demo, since the buffername plugins.lua
is longer than [No Name]
, both 1
and 2
were pushed more to the right.
How can I config to show file icon on tabs.
Error in plugin/tabby.vim
:
E746: Function name does not match script file name: Tabby#RenderTabline
tab = {
hl = tabby.hl:from('TabLine'),
outline = { left = '', right = '' },
active = {
border = { color = 'red', text = '|' },
},
},
```lua
I know that in the README, tabby.nvim is not supposed to be a buffers list but it also says that it is possible with low-level api...
Tabby.nvim focuses on a vim-style tab instead of buffers list, so tabby only displays the buffers in tabpage(although you can use low-level API to write a bufferline)
What would the configuration for this look like (assuming it's possible)?
Here's my config btw...
local filename = require('tabby.filename')
local util = require('tabby.util')
local hl_tabline = util.extract_nvim_hl('TabLine')
local hl_normal = util.extract_nvim_hl('Normal')
local hl_tabline_sel = util.extract_nvim_hl('TabLineSel')
local active_tab_hl = { fg = hl_normal.fg, bg = hl_normal.bg, style = 'bold' }
local inactive_tab_hl = { fg = hl_tabline.fg, bg = hl_tabline.bg }
local tabline = {
hl = 'TabLineFill',
layout = 'active_wins_at_tail',
head = {
{ ' ', hl = { fg = hl_tabline_sel.fg, bg = hl_tabline_sel.bg, style = 'bold' } },
{ ' ', hl = 'TabLineFill' }
},
active_tab = {
label = function(tabid)
return {
' ' .. tabid .. ' ',
hl = active_tab_hl,
}
end,
},
inactive_tab = {
label = function(tabid)
return {
' ' .. tabid .. ' ',
hl = inactive_tab_hl,
}
end,
},
top_win = {
label = function(winid)
return {
' ' .. filename.unique(winid) .. ' ',
hl = active_tab_hl
}
end,
left_sep = { ' ', hl = 'TabLineFill' },
},
win = {
label = function(winid)
return {
' ' .. filename.unique(winid) .. ' ',
hl = 'TabLine',
}
end,
left_sep = { ' ', hl = 'TabLineFill' },
},
}
require('tabby').setup{
tabline = tabline,
}
First off great plugin!
As a window manager user I see these tabs like workspaces. It would be great to have functions to manipulate tabs. For example selecting a tab based on a number. So you can map something like <leader>1
to jump to the first
workspace. What are your thoughts on this?
Rename a tab page, and provide a tool function to get it.
This line introduced a bug when cmd length is 2, because it generates the command "hi group cleared" instead of "hi group guibg=cleared"
e85cf1d#diff-22a223a33734b1de7e9d3ba974c3c6182519e16b846a399e9e30c19a8a9dffadR49
for better default config
unique shortname for buffers
{
tab = {
active = {},
},
win = {
focus = {},
active = {},
},
Inner layer config overwrite outer layer, this feature can use less line to config tabline.
A filter config key for certain windows to hide from the bar would be an useful addition.
An example would be the 'index' window label, when opening fugitives git status with :G
or terminal window labels the user does not deem as valuable.
On this pic, only the '[No name]' window label is useful to me.
related to #38
Hi!
It seems there is wrong tab renumbering when using the 'no-nerd-font-example.lua' example.
Here are the screenshots:
As far as I remember this issue is not reproducible when you use the 'Nerd-fonts' Tabby. Is this a specific 'no-nerd-font-example.lua' bug? Can you reproduce this?
Use more convenient and easier to combine configuration methods. Maybe:
label = { tabby.tab.number, tabby.tab.number, tabby.tab.close_btn }
Really love this pure tab plugin. I hate bufferline.
Are you planning to support scrollable feature just in case the tabs are too many or too long that cannot fit into the screen?
Thank you so much.
Upon running require('tabby.filename')
and require('tabby.util')
, I get the errors module 'tabby.filename' not found
and module 'tabby.util' not found
.
Is that a bug or were they removed?
As title. First, I appreciate this beautiful plugin and have a good time doing the customization. But regarding the coding part, It took me some time debugging to realize that tabbywin.buf
is actually a function instead of a field. That is, the working code looks kinda cumbersome:
line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
if not vim.api.nvim_buf_get_option(win.buf().id, 'buflisted') then return {} end
-- ^here
(In this code I assumed win
should mean tabby-win
as per your documentation)
At first, this is more of an aesthetic problem with the code. But then I notice that your documentation also said tabby.buf.id
. Could you elaborate more on this part?
Support chain calling
When renaming a tab through :TabRename
, it won't persist after closing the editor and recovering the previous session. Instead, the default behavior is back, with the focused buffer's name as the tab name.
I don't actually know if it's possible to persist this information, I have very little insight into how vim sessions work.
Thanks for the great plugin, really enjoy it.
Currently when the screen width is too short the tabline is truncated on the left side, hiding the tabs. I would prefer to truncate the windows list instead. Is it possible? If not, can it be added?
A more global solutions, I'm thinking about, would be giving each tabline chunk some truncation priority field.
What do you think?
If not then would it be possible to have an API to turn Tabby on/off?
Examples and Gallary
These are some awesome exmaples shared by tabby.nvim users! Also welcome to share your own!
Thanks for your plugin first.
But why 'cd' command changed the cwd of all tabs
Provide a easy way to get useful information to render tabline.
Since most plugin managers clone the git repository they should not have to download the assets of the plugin.
One solution is to move the assets to the built in wiki section of the GitHub repository. Since this is a separate repo the users don't have to download the assets, and you can still link to the files in the readme.
Either that or open an issue/pr and use that to upload images there and link to them.
Great plugin and it was an instant add to my config. Was thinking of writing one glad you did!
enviroment:
Iterm2
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
config:
use {
"nanozuki/tabby.nvim",
config = function()
require("tabby").setup({
tabline = require("tabby.presets").active_wins_at_tail,
})
end,
}
-- theme
use {
"sainnhe/sonokai",
requires = {
'nvim-treesitter/nvim-treesitter'
},
config = function()
vim.g.sonokai_style = "default"
vim.g.sonokai_enable_italic = 1
vim.cmd('colorscheme sonokai')
end
}
Currently, tabby will show the tabline even when there's only one tab open. It'd be nice if you had the option to show it only when there are multiple tabs open, the same way it works with the vanilla one.
I think this could be implemented as an option like show_when_n_or_more_tabs
. With the default 1
, it'd always show the tabline. However when changed to 2
, it'd only show the tabline when you have 2 or more tabs open, and changing to 3
would only show when there are 3 or more open.
I'm getting an error when starting tabby:
Error detected while processing function TabbyTabline:
line 1:
E5108: Error executing lua ...packer/start/tabby.nvim/lua/tabby/internal/highlight.lua:29: Vim(highlight):E411: highlight group not found: TabbyHl___
stack traceback:
[C]: in function 'cmd'
...packer/start/tabby.nvim/lua/tabby/internal/highlight.lua:29: in function 'register'
...ck/packer/start/tabby.nvim/lua/tabby/internal/render.lua:93: in function 'highlight'
...ck/packer/start/tabby.nvim/lua/tabby/internal/render.lua:67: in function 'frag'
...ck/packer/start/tabby.nvim/lua/tabby/internal/render.lua:24: in function 'node'
...ck/packer/start/tabby.nvim/lua/tabby/internal/render.lua:65: in function
<...ck/packer/start/tabby.nvim/lua/tabby/internal/render.lua:57>
vim/shared.lua: in function 'tbl_map'
.../site/pack/packer/start/tabby.nvim/lua/tabby/tabline.lua:146: in function 'update'
[string "luaeval()"]:1: in main chunk
It's quite inconsistent. It only happens on some startups, in others it just runs fine (feels like 50/50 chance). When the error happens, the tabline does not load correctly. Here's some screenshots of how the tab normally looks like, and how it looks like with the error:
This is my full config:
local filename = require('tabby.filename')
local util = require('tabby.util')
local hl_tabline = util.extract_nvim_hl('TabLine')
local hl_tabline_sel = util.extract_nvim_hl('TabLineSel')
local hl_tabline_fill = util.extract_nvim_hl('TabLineFill')
local function tab_label(tabid, active)
local icon = active and '' or ''
local number = vim.api.nvim_tabpage_get_number(tabid)
local name = util.get_tab_name(tabid)
if active then
return string.format(' %s %d: %s ', icon, number, name)
else
return string.format(' %s %d ', icon, number)
end
end
local tabline = {
hl = 'TabLineFill',
layout = 'tab_only',
head = {
{ ' ', hl = { fg = hl_tabline.fg, bg = hl_tabline.bg } },
{ '', hl = { fg = hl_tabline.bg, bg = hl_tabline_fill.bg } },
},
active_tab = {
label = function(tabid)
return {
tab_label(tabid, true),
hl = { fg = hl_tabline_sel.fg, bg = hl_tabline_sel.bg, style = 'bold' },
}
end,
left_sep = { '', hl = { fg = hl_tabline_sel.bg, bg = hl_tabline_fill.bg } },
right_sep = { '', hl = { fg = hl_tabline_sel.bg, bg = hl_tabline_fill.bg } },
},
inactive_tab = {
label = function(tabid)
return {
tab_label(tabid, false),
hl = { fg = hl_tabline.fg, bg = hl_tabline.bg, style = 'bold' },
}
end,
left_sep = { '', hl = { fg = hl_tabline_fill.bg, bg = hl_tabline_fill.bg } },
right_sep = { '', hl = { fg = hl_tabline_fill.bg, bg = hl_tabline_fill.bg } },
},
top_win = {
label = function(winid)
return {
--' > ' .. filename.unique(winid) .. ' ',
'',
hl = 'TabLine',
}
end,
left_sep = { ' ', hl = 'TabLineFill' },
},
win = {
label = function(winid)
return {
--' - ' .. filename.unique(winid) .. ' ',
'',
hl = 'TabLine',
}
end,
left_sep = { ' ', hl = 'TabLineFill' },
},
}
require('tabby').setup({
tabline = tabline,
})
When I run :PackerSync
I get the following error.
packer.nvim: Error running config for tabby.nvim: vim/shared.lua:0: after the second argument: expected table, got nil
Here is my config.
use { "nanozuki/tabby.nvim",
requires = "kyazdani42/nvim-web-devicons",
after = "nightfox.nvim",
config = function()
require("tabby").setup({})
end
}
tab = {
hl = tabby.hl:from('TabLine'),
label = { '', tabby.tab.number, tabby.tab.name, tabby.tab.close_btn('x') },
join = ' ',
Hello,
Thanks for the Tabby plugin 🙏
I created a custom tabline in my config but it no longer works with v2.
I do plan on upgrading to v2 eventually but I saw the readme mentions:
Tabby thinks it's essential to stay backward compatible! So even if Tabby releases a brand new 2.0, it will not break the 1.0 configuration.
I thought I might be missing something simple so until I have the time to learn the new API and upgrade my code, is there an easy way to make my config work with the new version?
Or should I just lock the plugin to v1 until I update my tabline code?
Thanks?
Hello,
I'm using neovim 0.7.0, with vim plug. I was able to install tabby without any problem, but it won't launch, and by using :lua require("tabby").setup()
, it will always output the following error, guibg=
wasn't provided. This looks like #55 but after looking at the code it could be because there is a nil check here (https://github.com/nanozuki/tabby.nvim/blob/main/lua/tabby/module/highlight.lua#L45) but no empty string check?
Bufferline.nvim (docs) has filter option. Also it filter when you navigate between buffers (because of custom :BufferLineCycleNext command).
I know it's easy to make it. But I think it will really useful to make ready custom command and filter. I personally use it for nvim-dap (it create repl as buffer).
win = {
hl = tabby.hl:from('TabLine'),
label = { '', tabby.win.name:unique() },
The image shows the problem.
I'm using the nerd-fonts-jetbrains-mono
font from the Arch User Repository, this same problem occurs in VTE based terminals, as well as in alacritty and konsole.
Using ttf-nerd-fonts-symbols
from the Arch repos shows a similar problem with the glyphs:
Using other nerd font patched fonts like hack shows yet the same problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.