From a544c622d31187f245b34b9b8b17cbb63a941480 Mon Sep 17 00:00:00 2001 From: triethyl Date: Tue, 8 Jul 2025 15:44:17 -0400 Subject: configured lualine and tabby Former-commit-id: 947770af8ae586dfc89c0d498a766c7aaa802dd2 --- pkgs/custom-neovim/config/lua/plugins/lualine.lua | 154 ++++++++++------------ pkgs/custom-neovim/config/lua/plugins/tabby.lua | 56 +++++++- 2 files changed, 126 insertions(+), 84 deletions(-) (limited to 'pkgs/custom-neovim/config/lua/plugins') diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua index 409c452..b38d3ed 100644 --- a/pkgs/custom-neovim/config/lua/plugins/lualine.lua +++ b/pkgs/custom-neovim/config/lua/plugins/lualine.lua @@ -1,98 +1,88 @@ -local auto_theme = require("lualine.themes.auto") - -local colors = { - modes = { - normal = auto_theme.normal.a.bg, - insert = auto_theme.insert.a.bg, - visual = auto_theme.visual.a.bg, - replace = auto_theme.replace.a.bg, - command = auto_theme.command.a.bg, - inactive = auto_theme.inactive.a.bg, - }, - text = { - dark = auto_theme.normal.a.fg, - light = auto_theme.normal.c.fg, - }, - backdrop = auto_theme.normal.c.bg, -} - -local custom_auto_theme = { - normal = { - a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, - }, - insert = { - a = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, - }, - visual = { - a = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, - }, - replace = { - a = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, - }, - command = { - a = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, - }, - inactive = { - a = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.backdrop, fg = colors.text.light}, - c = {bg = colors.backdrop, fg = colors.text.light}, - x = {bg = colors.backdrop, fg = colors.text.light}, - y = {bg = colors.backdrop, fg = colors.text.light}, - z = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, - }, -}; +local generate_lualine_theme = function() + local colors = utils.generate_theme_from_lualine() + return { + normal = { + a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + }, + insert = { + a = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + }, + visual = { + a = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + }, + replace = { + a = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + }, + command = { + a = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + }, + inactive = { + a = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + }, + }; +end require('lualine').setup { options = { - theme = custom_auto_theme, + theme = generate_lualine_theme(), component_separators = "", - section_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, }, sections = { - lualine_a = { { 'mode', separator = { left = '', rignt = '' }, right_padding = 2 } }, - lualine_b = { 'filename', 'branch' }, - lualine_c = { - '%=', --[[ add your center components here in place of this comment ]] - }, - lualine_x = {}, - lualine_y = { 'filetype', 'progress' }, + lualine_a = { { 'mode', separator = { left = '', rignt = '' }, right_padding = 2 } }, -- { left = '', rignt = '' } + lualine_b = { 'filename', 'diff' }, + lualine_c = { 'branch' }, + lualine_x = { {'diagnostics', sources = { 'nvim_lsp' } } }, + lualine_y = { 'lsp_status', 'progress' }, lualine_z = { - { 'location', separator = { left = '', right = '' }, left_padding = 2 }, + { 'location', separator = { left = '', right = '' }, left_padding = 2 }, }, }, inactive_sections = { - lualine_a = { 'filename' }, - lualine_b = {}, + lualine_a = {}, + lualine_b = { 'filename' }, lualine_c = {}, lualine_x = {}, - lualine_y = {}, - lualine_z = { 'location' }, + lualine_y = { 'location' }, + lualine_z = {}, }, tabline = {}, extensions = {}, } + +-- vim.api.nvim_create_autocmd("ColorScheme", { +-- callback = function() +-- setup_lualine() +-- print "colorscheme changed" +-- end, +-- }) diff --git a/pkgs/custom-neovim/config/lua/plugins/tabby.lua b/pkgs/custom-neovim/config/lua/plugins/tabby.lua index 2ad03ed..ecba331 100644 --- a/pkgs/custom-neovim/config/lua/plugins/tabby.lua +++ b/pkgs/custom-neovim/config/lua/plugins/tabby.lua @@ -1,2 +1,54 @@ -vim.o.showtabline = 1 -require('tabby').setup() +local general_theme = utils.generate_theme_from_lualine() +local colors = { + current = { fg = general_theme.modes.insert, bg = general_theme.background, style = 'bold'}, + not_current = { fg = general_theme.text.light, bg = general_theme.background }; + fill = { bg = general_theme.background }; +}; +local theme = { + fill = colors.fill, + -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' } + head = colors.fill, + current_tab = colors.current, + tab = colors.not_current, + win = colors.fill, + tail = colors.fill, +} +require('tabby').setup({ + line = function(line) + return { + { + -- { '  ', hl = theme.head }, + -- line.sep('', theme.head, theme.fill), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + line.sep('', hl, theme.fill), + -- tab.is_current() and '' or '󰆣', + tab.number(), + tab.name(), + line.sep('', hl, theme.fill), + hl = hl, + margin = ' ', + } + end), + line.spacer(), + line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) + return { + line.sep('', theme.win, theme.fill), + -- win.is_current() and '' or '', + win.buf_name(), + line.sep('', theme.win, theme.fill), + hl = theme.win, + margin = ' ', + } + end), + { + line.sep('', theme.tail, theme.fill), + { '  ', hl = theme.tail }, + }, + hl = theme.fill, + } + end, + -- option = {}, -- setup modules' option, +}) -- cgit v1.2.3