Skip to content

Commit

Permalink
tabby + ctrl-space full integration
Browse files Browse the repository at this point in the history
  • Loading branch information
lvim-tech committed Jan 9, 2022
1 parent 2914bc9 commit 989b022
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lua/modules/global/configs/editor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ function config.tabby()
color_03 = "#79a88b"
}

local get_var = function(tab_number)
local s, v =
pcall(
function()
return vim.api.nvim_eval("ctrlspace#util#Gettabvar(" .. tab_number .. ", 'CtrlSpaceLabel')")
end
)
if s then
if v == "" then
return tab_number
else
return v
end
else
return tab_number
end
end

local components = function()
local coms = {
{
Expand All @@ -24,15 +42,18 @@ function config.tabby()
}
local tabs = vim.api.nvim_list_tabpages()
local current_tab = vim.api.nvim_get_current_tabpage()
local name_of_buf
for _, tabid in ipairs(tabs) do
local tab_number = vim.api.nvim_tabpage_get_number(tabid)
name_of_buf = get_var(tab_number)
if tabid == current_tab then
table.insert(
coms,
{
type = "tab",
tabid = tabid,
label = {
" " .. vim.api.nvim_tabpage_get_number(tabid) .. " ",
" " .. name_of_buf .. " ",
hl = {fg = hl_tabline.color_02, bg = hl_tabline.color_01}
}
}
Expand Down Expand Up @@ -62,7 +83,7 @@ function config.tabby()
type = "tab",
tabid = tabid,
label = {
" " .. vim.api.nvim_tabpage_get_number(tabid) .. " ",
" " .. name_of_buf .. " ",
hl = {fg = hl_tabline.color_01, bg = hl_tabline.color_02}
}
}
Expand Down

0 comments on commit 989b022

Please sign in to comment.