Add a new option in TabbyLineOption.buf_name called override which is a function that takes bufid and returns optional string. If nil is returned, win.buf_name() returns as normal, but if any string is returned, win.buf_name() returns it without any changes.
It's useful for giving distinctive names to temporary buffers that otherwise have either unhelpful or empty names. For example, for vim-fugitive temp buffers:
require('tabby').setup({
option = {
buf_name = {
override = function(bufid)
local filetype = vim.api.nvim_buf_get_option(bufid, 'filetype')
if filetype ~= 'git' then return nil end -- Display default name for everything else
local fugitive_info = vim.fn.FugitiveResult(vim.api.nvim_buf_get_name(bufid))
return 'git ' .. table.concat(fugitive_info.args, ' ') -- Display respective git command
end,
},
},
})
Add a new option in
TabbyLineOption.buf_name
calledoverride
which is a function that takesbufid
and returns optional string. Ifnil
is returned,win.buf_name()
returns as normal, but if any string is returned,win.buf_name()
returns it without any changes.It's useful for giving distinctive names to temporary buffers that otherwise have either unhelpful or empty names. For example, for vim-fugitive temp buffers: