Comments (24)
@yitsushi @moevis, thanks for the feedback! After I remove all themes, I reproduce this bug. I'll fix this in days. Sadly, My mini-config for testing has a theme. So I can't find this issue
from tabby.nvim.
Thanks for your feedback, I will do some tests in this week.
from tabby.nvim.
Went through the commits one by one and called PackerUpdate
, the first commit where I can see the error: 7866ad7
I'm not good enough with lua to figure out why
Until fixed:
use {
"nanozuki/tabby.nvim",
commit = 'fcbd6ee548e8e8ce0e409d0727bd198d2ff17098',
....
}
from tabby.nvim.
I fixed it; I used the wrong way to get Highlight. If there are more compatibility issues, welcome to tell me.
from tabby.nvim.
The key point of this question is:
The sentence local hl_tabline = util.extract_nvim_hl('TabLine')
should be called after theme loaded. If not, you will get the wrong color. Mentions, not the tabby should be loaded after the theme, is this util.extract_nvim_hl
should be called after the theme is loaded.
This is why I need the whole neovim config if I want to figure out the problem. If you use packer, you should add config to the plugin declaration, so packer will confirm the config runner after the plugin is loaded. It will delay the calling of function util.extract_nvim_hl
.
If your config is too large, you can try to write a minimal config to reproduce it.
from tabby.nvim.
Because the separator's highlight is calculated from two highlights, I can't link directly. I'm exploring a new way to get highlights.
from tabby.nvim.
Am I understanding correctly that the current approach won't allow theme or (more importantly background) change while nvim is already running?
For current preset configs, it is. I'm writing the next version of tabby, It has a better way to automatically handle color scheme changing.
from tabby.nvim.
In case you cannot repro...
Debugging info
With this config, the plugin works, but the colors are inconsistent:
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',
-- REMOVED HEAD
active_tab = {
label = function(tabid)
return {
tab_label(tabid, true),
hl = { fg = hl_tabline_sel.fg, bg = hl_tabline_sel.bg, style = 'bold' },
}
-- REMOVED SEP
end,
},
inactive_tab = {
label = function(tabid)
return {
tab_label(tabid, false),
hl = { fg = hl_tabline.fg, bg = hl_tabline.bg, style = 'bold' },
}
-- REMOVED SEP
end,
},
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,
})
Same results (inconsistent colors) with this simpler one:
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',
active_tab = {
label = function(tabid)
return {
tab_label(tabid, true),
hl = { fg = hl_tabline_sel.fg, bg = hl_tabline_sel.bg, style = 'bold' },
}
end,
},
}
require('tabby').setup({
tabline = tabline,
})
However, more bizarrely, if I complete remove all options, the error returns. The config below yields the error again:
require('tabby').setup({})
from tabby.nvim.
Note: It was introduced somewhere in the the commits on May/10 or May/11, I last synced around end of April, today I synced plugins and it's there.
from tabby.nvim.
@yitsushi After I read the code, I think maybe this is the bug I fixed in the latest commit. May you try the latest commit and test it again?
from tabby.nvim.
I got the same problem with latest code.
I just use default config likes following:
require"tabby".setup({})
and here is the output:
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 <...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
In addtion, when I initialized the plugin without a map param
require"tabby".setup()
I got these error:
Error detected while processing /Users/bytedance/.config/nvim/init.lua:
E5113: Error while calling lua chunk: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_extend'
...vim/site/pack/packer/start/tabby.nvim/lua/tabby/init.lua:14: in function 'setup'
/Users/bytedance/.config/nvim/init.lua:572: in main chunk
My neovim version is
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]
on macOS 12.4
from tabby.nvim.
After I tried several presets, I found this config seems to have no error throwed.
require"tabby".setup({
tabline = require("tabby.presets").tab_with_top_win,
})
But the apperance is strange:
Following presets will throw error: highlight group not found: TabbyHl___
active_wins_at_tail
active_tab_with_wins
tab_only
from tabby.nvim.
I can confirm, updated to the latest commit and no errors on my side (with the same setup I had before)
from tabby.nvim.
Yep the TabbyHl__
error is gone!
I'm still getting the wrong highlight sometimes though. Same error as I mentioned in my "debugging info". Sometimes I get the right highlight, sometimes it uses a (wrong) gray color. Here's an example with my full config (in the original issue):
The chances of this happening looks exactly like the chances of me getting the original one, about 50/50.
Also these were mutually exclusive. By that I mean that, depending on the config, I would either get one, or the other (i.e. they would replace one another). So, I have high suspicions that these two are related.
from tabby.nvim.
I can confirm wrong highlights
from tabby.nvim.
@luiz00martins One scenario I've found that causes this is the order in which tabby and theme are launched. May you use packer, try to use the after
option as a workaround? I would to explore a nice way to improve this.
from tabby.nvim.
@anstadnik Oh, May you tell me what theme you use?
from tabby.nvim.
@nanozuki sure :)
minimal init.lua
vim.g.python3_host_prog = '/home/astadnik/.virtualenvs/neovim/bin/python3'
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.termopen(('git clone --depth 1 https://github.com/wbthomason/packer.nvim %q'):format(install_path))
end
require('packer').startup({ function(use)
use { 'rmehri01/onenord.nvim', config = [[require 'plugins.onenord']] }
use { "nanozuki/tabby.nvim",
config = [[require("tabby").setup({ tabline = require("tabby.presets").active_tab_with_wins })]] }
end})
% vim.o.background='light'
from tabby.nvim.
Oh you maybe would want to see onenord.lua
.
onenord.lua
-- Colorscheme
require('onenord').setup({
fade_nc = true, -- Fade non-current windows, making them more distinguishable
-- Style that is applied to various groups: see `highlight-args` for options
styles = {
comments = "italic",
strings = "italic",
keywords = "bold",
functions = "NONE",
variables = "NONE",
diagnostics = "undercurl",
},
disable = {
background = false, -- Disable setting the background color
cursorline = false, -- Disable the cursorline
eob_lines = true, -- Hide the end-of-buffer lines
},
-- Inverse highlight for different groups
inverse = {
match_paren = true,
},
})
from tabby.nvim.
@luiz00martins One scenario I've found that causes this is the order in which tabby and theme are launched. May you use packer, try to use the
after
option as a workaround? I would to explore a nice way to improve this.
Tried it, with no luck. Got the same problem with the following use
clause:
use {
'nanozuki/tabby.nvim',
after = 'folke/tokyonight.nvim',
}
from tabby.nvim.
@luiz00martins What about your whole config, including the plugin manager's setting? Do you put the config of tabby.nvim
in the packer's plugin declaration? Like this:
use {
'nanozuki/tabby.nvim',
config = function()
require('tabby').setup({})
end
}
from tabby.nvim.
I already showed my whole tabby config, it's in the original issue (and it's definetely being called, although manually, not in config
).
See my previous comments. I posted a lot of configs I tested, and a lot of screeshots of the results.
My whole config is the use clause:
use {
'nanozuki/tabby.nvim',
after = 'tokyonight.nvim',
}
followed by the actual config, which is wrapped in a function:
plugin_configs['tabby'] = function()
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,
})
end
which is eventually called:
plugin_configs['tabby']()
And I'd love to debug it more, but I'm being blocked by #64
Edit: #64 was resolved, and I can confirm that the after
clause does not solve the HL problem.
from tabby.nvim.
The sentence local
hl_tabline = util.extract_nvim_hl('TabLine')
should be called after theme loaded. If not, you will get the wrong color.
That's it! Making sure that runs after setting the colorscheme fixes the problem. Thanks.
If tabby currently pulls in "hard values" from the colorscheme, maybe linking to the HL group instead could fix this behaviour.
from tabby.nvim.
Am I understanding correctly that the current approach won't allow theme or (more importantly background) change while nvim is already running?
from tabby.nvim.
Related Issues (20)
- Tabline Background Seems Corrupted HOT 6
- Changing colorscheme without restarting causes inconsistent highlighting HOT 4
- Add option to use lualine compatiable theme HOT 1
- Support customer mouse handler
- refactor doc
- [Bug] Not finding tabby modules HOT 7
- Missing guibg HOT 1
- Highlighting problem: hi <group> cleared does not exists HOT 1
- Custom tab names don't persist across sessions HOT 17
- Function name does not match script file name: Tabby#RenderTabline HOT 1
- The tab icon is incorrect HOT 1
- Is there any way to toggle the plugin on and off? HOT 2
- In the preset, the color of the tab and the border color are inconsistent
- Backwards compatibility HOT 5
- Add buffer filter HOT 6
- Weird redraw issue when entering command mode HOT 4
- Add option to choose truncate mode HOT 5
- Why it's `win.buf().id` not `win.buf.id`? HOT 2
- It seems that the `line.spacer()` doesn't work correctly HOT 3
- Is it possible to assign a name when creating a new tab? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tabby.nvim.