Closed is0n closed 2 years ago
Yes, you can set a buffer line by tabby.nvim. But you can only use low level API to make it, because the layout of high level is fixed. Here is a simple example:
local components = function()
local coms = {}
local cur_bufid = vim.api.nvim_get_current_buf()
for _, bufid in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_valid(bufid) and vim.bo[bufid].buflisted then
local hl = 'TabLine'
if bufid == cur_bufid then
hl = 'TabLineSel'
end
local buf_name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufid), ':~:.')
table.insert(coms, {
type = 'text',
text = {
string.format(' %d: %s ', bufid, buf_name),
hl = hl,
},
})
table.insert(coms, {
type = 'text',
text = {
' ',
hl = 'TabLineFill',
},
})
end
end
return coms
end
require('tabby').setup({
components = components,
})
But for now, the customer handler of mouse click not implemented(in TODO list). So cannot click buffer label to switch buffer yet.
How could I put the buffers at the tail of my config?
You can put a separator in the front of the components array.
{ type = "spring" }
and the buffer labels will be pushed to the end.
Do you mind I covert this issue to a discussion? I think this may be helping other users.
You can put a separator in the front of the components array.
Could you be a bit more specific?
Do you mind I covert this issue to a discussion? I think this may be helping other users.
I think that's a great idea :D
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...
What would the configuration for this look like (assuming it's possible)?
Here's my config btw...