From 0f8c62f2d18fd86e2bad01a33e5e9beb4e2ef77b Mon Sep 17 00:00:00 2001 From: nathan11 Date: Tue, 25 Jul 2023 00:52:07 -0600 Subject: first commit --- lua/tab_component.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lua/tab_component.lua (limited to 'lua/tab_component.lua') diff --git a/lua/tab_component.lua b/lua/tab_component.lua new file mode 100644 index 0000000..44fae45 --- /dev/null +++ b/lua/tab_component.lua @@ -0,0 +1,27 @@ +local M = {} + +local fmt = function(name, context) + local buflist = vim.fn.tabpagebuflist(context.tabnr) + local current_tab = vim.api.nvim_get_current_tabpage() + local winnr = vim.fn.tabpagewinnr(context.tabnr) + local bufnr = buflist[winnr] + local mod = vim.fn.getbufvar(bufnr, '&mod') + local icon = require('nvim-web-devicons').get_icon(name) + + if icon == nil then + icon = '' + else + icon = icon .. ' ' + end + + return icon .. name .. " " .. context.tabnr +end + +M.tab_component = { + "tabs", + max_length = vim.o.columns, + mode = 1, + fmt = fmt +} + +return M -- cgit v1.2.3