Open Pablo1107 opened 2 years ago
A solution could be to add some padding on the left in update-status
depending on status-left
, status
right`, and panes titles, but we do not have access to these last objets.
Here is an example to merge vim statusline into wezterm's status bar, with tab titles centered.
https://github.com/Congee/nix/blob/8394e6b13bfd870925a5d750afb8475a5502db6a/config/.wezterm.lua#L245-L269 https://github.com/Congee/nix/blob/8394e6b13bfd870925a5d750afb8475a5502db6a/config/nvim/lua/wezterm_bar.lua#L25
@Congee Thank you.
Since, I don't want to merge the tab bar with vim status line, it boils down to:
-- Center tab bar
wezterm.on("update-status", function(gui_window, pane)
local tabs = gui_window:mux_window():tabs();
local mid_width = 0;
for idx, tab in ipairs(tabs) do
local title = tab:get_title();
mid_width = mid_width + math.floor(math.log(idx, 10)) + 1
mid_width = mid_width + 2 + #title + 1
end
local tab_width = gui_window:active_tab():get_size().cols;
local max_left = tab_width / 2 - mid_width / 2;
gui_window:set_left_status(wezterm.pad_left(' ', max_left))
gui_window:set_right_status('')
end)
The caveat with this is the workspace name is pushed out of the screen.
Is your feature request related to a problem? Please describe. Trying to imitate my custom bar that I use in tmux.
I get something like this:
Describe the solution you'd like I would like to be able to have those tabs title in the center of the window.