diff --git a/lua/cosmic/modules/statusline/init.lua b/lua/cosmic/modules/statusline/init.lua index de6affa..9e87d43 100644 --- a/lua/cosmic/modules/statusline/init.lua +++ b/lua/cosmic/modules/statusline/init.lua @@ -8,6 +8,8 @@ local colors = require('cosmic.theme.colors') local highlight = require('cosmic.theme.utils').highlight local icons = require('cosmic.theme.icons') local config = require('cosmic.config') +local get_highlight = require('cosmic.theme.utils').get_highlight +local statusline_colors = get_highlight('StatusLine') local defaults = vim.tbl_deep_extend('force', { statusline = { @@ -50,7 +52,7 @@ local function get_git_root() return get_basename(git_root) .. ' ' end -local check_width_and_git_and_buffer = function() +local check_git_and_buffer = function() return condition.check_git_workspace() and condition.buffer_not_empty() end @@ -122,31 +124,6 @@ galaxy.short_line_list = { 'fugitiveblame', } -gls.mid = { - { - LSPStatus = { - provider = function() - local clients = utils.get_active_lsp_client_names() - local client_str = '' - - if #clients < 1 then - return client_str - end - - for i, client in ipairs(clients) do - client_str = client_str .. client - if i < #clients then - client_str = client_str .. ', ' - end - end - - return 'LSP: [' .. client_str .. ']' - end, - highlight = 'GalaxyText', - }, - }, -} - gls.left = { { GhostLeftBracket = { @@ -177,10 +154,10 @@ gls.left = { local label, mode_color, mode_nested = unpack(m) highlight('GalaxyViMode', mode_color, mode_nested) highlight('GalaxyViModeInv', mode_nested, mode_color) - highlight('GalaxyViModeNested', mode_nested, colors.statusline_bg) - highlight('GalaxyViModeNestedInv', colors.statusline_bg, mode_nested) - highlight('GalaxyPercentBracket', colors.statusline_bg, mode_color) - highlight('GalaxyText', colors.statusline_bg, mode_color) + highlight('GalaxyViModeNested', mode_nested, 'StatusLine') + highlight('GalaxyViModeNestedInv', 'StatusLine', mode_nested) + highlight('GalaxyPercentBracket', 'StatusLine', mode_color) + highlight('GalaxyText', 'StatusLine', mode_color) highlight('GalaxyGitLCBracket', mode_nested, mode_color) @@ -188,9 +165,9 @@ gls.left = { highlight('GalaxyViModeBracket', mode_nested, mode_color) else if condition.check_git_workspace() then - highlight('GalaxyGitLCBracket', colors.statusline_bg, mode_color) + highlight('GalaxyGitLCBracket', 'StatusLine', mode_color) end - highlight('GalaxyViModeBracket', colors.statusline_bg, mode_color) + highlight('GalaxyViModeBracket', 'StatusLine', mode_color) end return ' ' .. label .. ' ' end, @@ -205,7 +182,7 @@ gls.left = { { GitIcon = { provider = BracketProvider(' ' .. icons.branch .. ' ', true), - condition = check_width_and_git_and_buffer, + condition = check_git_and_buffer, highlight = 'GalaxyViModeInv', }, }, @@ -222,7 +199,7 @@ gls.left = { end return branch_name .. ' ' end, - condition = check_width_and_git_and_buffer, + condition = check_git_and_buffer, highlight = 'GalaxyViModeInv', separator = icons.arrow_right, separator_highlight = 'GalaxyViModeInv', @@ -262,30 +239,24 @@ gls.left = { DiffAdd = { provider = 'DiffAdd', icon = ' ' .. icons.diff_add, - condition = check_width_and_git_and_buffer, - highlight = { colors.diffAdd, colors.statusline_bg }, + condition = check_git_and_buffer, + highlight = { colors.diffAdd, 'StatusLine' }, }, }, { DiffModified = { provider = 'DiffModified', - condition = check_width_and_git_and_buffer, + condition = check_git_and_buffer, icon = ' ' .. icons.diff_modified, - highlight = { colors.diffModified, colors.statusline_bg }, + highlight = { colors.diffModified, 'StatusLine' }, }, }, { DiffRemove = { provider = 'DiffRemove', - condition = check_width_and_git_and_buffer, + condition = check_git_and_buffer, icon = ' ' .. icons.diff_remove, - highlight = { colors.diffDeleted, colors.statusline_bg }, - }, - }, - { - WSpace = { - provider = 'WhiteSpace', - highlight = { colors.statusline_bg, colors.statusline_bg }, + highlight = { colors.diffDeleted, 'StatusLine' }, }, }, } @@ -368,6 +339,40 @@ gls.right = { highlight = 'GalaxyViModeNestedInv', }, }, + { + LSPStatus = { + provider = function() + local clients = utils.get_active_lsp_client_names() + local client_str = '' + + if #clients < 1 then + return client_str + end + + for i, client in ipairs(clients) do + client_str = client_str .. client + if i < #clients then + client_str = client_str .. ', ' + end + end + + if client_str:len() < 1 then + return + end + + return ' LSP: [' .. client_str .. ']' + end, + highlight = 'GalaxyViModeInv', + condition = check_buffer_and_width, + }, + }, + { + LSPStatusArrow = { + provider = BracketProvider(' ' .. icons.arrow_left, true), + highlight = 'GalaxyViModeInv', + condition = check_buffer_and_width, + }, + }, { GitRoot = { provider = get_git_root, @@ -412,19 +417,19 @@ gls.short_line_left = { { GhostLeftBracketShort = { provider = BracketProvider(icons.rounded_left_filled, true), - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, { GhostShort = { provider = BracketProvider(main_icon, true), - highlight = { colors.statusline_bg, colors.white }, + highlight = { 'StatusLine', colors.white }, }, }, { GhostRightBracketShort = { provider = BracketProvider(icons.rounded_right_filled, true), - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, { @@ -440,7 +445,7 @@ gls.short_line_left = { end, highlight = { require('galaxyline.providers.fileinfo').get_file_icon, - colors.statusline_bg, + 'StatusLine', }, }, }, @@ -450,7 +455,7 @@ gls.short_line_left = { condition = function() return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree' end, - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, { @@ -459,7 +464,7 @@ gls.short_line_left = { condition = function() return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree' end, - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, } @@ -469,7 +474,7 @@ gls.short_line_right = { GitRootShortLeftBracket = { provider = BracketProvider(icons.arrow_left_filled, true), condition = condition.buffer_not_empty, - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, { @@ -477,14 +482,14 @@ gls.short_line_right = { provider = get_git_root, condition = condition.buffer_not_empty, icon = ' ' .. icons.file .. ' ', - highlight = { colors.statusline_bg, colors.white }, + highlight = { statusline_colors.guibg, colors.white }, }, }, { GitRootShortRightBracket = { provider = BracketProvider(icons.rounded_right_filled, true), condition = condition.buffer_not_empty, - highlight = { colors.white, colors.statusline_bg }, + highlight = { colors.white, 'StatusLine' }, }, }, } diff --git a/lua/cosmic/theme/init.lua b/lua/cosmic/theme/init.lua index 712ab3a..61b3ce7 100644 --- a/lua/cosmic/theme/init.lua +++ b/lua/cosmic/theme/init.lua @@ -6,15 +6,13 @@ local highlight = require('cosmic.theme.utils').highlight local get_highlight = require('cosmic.theme.utils').get_highlight local set_highlight = require('cosmic.theme.utils').set_highlight --- @TODO: can i get rid of this? -highlight('StatusLine', colors.statusline_bg, colors.statusline_bg) - +local statusline_colors = get_highlight('StatusLine') local error_colors = get_highlight('DiagnosticError') set_highlight( 'DiagnosticErrorInv', vim.tbl_extend('force', error_colors, { guibg = error_colors.guifg, - guifg = colors.statusline_bg, + guifg = statusline_colors.guibg, }) ) @@ -23,7 +21,7 @@ set_highlight( 'DiagnosticWarnInv', vim.tbl_extend('force', warning_colors, { guibg = warning_colors.guifg, - guifg = colors.statusline_bg, + guifg = statusline_colors.guibg, }) ) @@ -32,7 +30,7 @@ set_highlight( 'DiagnosticHintInv', vim.tbl_extend('force', hint_colors, { guibg = hint_colors.guifg, - guifg = colors.statusline_bg, + guifg = statusline_colors.guibg, }) ) @@ -41,7 +39,7 @@ set_highlight( 'DiagnosticInfoInv', vim.tbl_extend('force', info_colors, { guibg = info_colors.guifg, - guifg = colors.statusline_bg, + guifg = statusline_colors.guibg, }) ) diff --git a/lua/cosmic/theme/integrated/catppuccin.lua b/lua/cosmic/theme/integrated/catppuccin.lua index cadafcb..fe2b842 100644 --- a/lua/cosmic/theme/integrated/catppuccin.lua +++ b/lua/cosmic/theme/integrated/catppuccin.lua @@ -4,7 +4,6 @@ local colors = { white = theme.catppuccin0, bg = theme.catppuccin12, bg_highlight = theme.catppuccin15, - statusline_bg = theme.catppuccin14, normal = theme.catppuccin3, insert = theme.catppuccin4, command = theme.catppuccin5, diff --git a/lua/cosmic/theme/integrated/dracula.lua b/lua/cosmic/theme/integrated/dracula.lua index a543285..0d6454f 100644 --- a/lua/cosmic/theme/integrated/dracula.lua +++ b/lua/cosmic/theme/integrated/dracula.lua @@ -31,7 +31,6 @@ local colors = { white = theme.white, bg = theme.nontext, bg_highlight = theme.nontext, - statusline_bg = theme.bg, normal = theme.bright_green, insert = theme.bright_cyan, command = theme.orange, diff --git a/lua/cosmic/theme/integrated/enfocado.lua b/lua/cosmic/theme/integrated/enfocado.lua index c40620e..625cd48 100644 --- a/lua/cosmic/theme/integrated/enfocado.lua +++ b/lua/cosmic/theme/integrated/enfocado.lua @@ -27,7 +27,6 @@ local colors = { white = theme.fg_1, bg = theme.bg_2, bg_highlight = theme.bg_2, - statusline_bg = theme.bg_1, normal = theme.green, insert = theme.cyan, command = theme.orange, diff --git a/lua/cosmic/theme/integrated/gruvbox.lua b/lua/cosmic/theme/integrated/gruvbox.lua index cb6c7a5..a52a9d6 100644 --- a/lua/cosmic/theme/integrated/gruvbox.lua +++ b/lua/cosmic/theme/integrated/gruvbox.lua @@ -5,7 +5,6 @@ local colors = { white = convert.hsl_to_hex(theme.light0_hard), bg = convert.hsl_to_hex(theme.dark0), bg_highlight = convert.hsl_to_hex(theme.dark1), - statusline_bg = convert.hsl_to_hex(theme.dark2), normal = convert.hsl_to_hex(theme.neutral_yellow), insert = convert.hsl_to_hex(theme.neutral_green), command = convert.hsl_to_hex(theme.neutral_orange), diff --git a/lua/cosmic/theme/integrated/nightfox.lua b/lua/cosmic/theme/integrated/nightfox.lua index c9b2457..c550759 100644 --- a/lua/cosmic/theme/integrated/nightfox.lua +++ b/lua/cosmic/theme/integrated/nightfox.lua @@ -5,7 +5,6 @@ local colors = { white = themeColors.fg_alt, bg = themeColors.bg, bg_highlight = themeColors.bg_highlight, - statusline_bg = themeColors.bg_alt, normal = themeColors.blue, insert = themeColors.cyan, command = themeColors.orange, @@ -23,4 +22,5 @@ local colors = { selection_caret = themeColors.pink, } -return colors \ No newline at end of file +return colors + diff --git a/lua/cosmic/theme/integrated/nord.lua b/lua/cosmic/theme/integrated/nord.lua index ab7aa0e..3ec563f 100644 --- a/lua/cosmic/theme/integrated/nord.lua +++ b/lua/cosmic/theme/integrated/nord.lua @@ -3,7 +3,6 @@ local colors = { white = theme.nord4_gui, bg = theme.nord1_gui, bg_highlight = theme.nord1_gui, - statusline_bg = theme.nord2_gui, normal = theme.nord9_gui, insert = theme.nord14_gui, command = theme.nord13_gui, diff --git a/lua/cosmic/theme/integrated/onedark.lua b/lua/cosmic/theme/integrated/onedark.lua index 814f30f..87942cd 100644 --- a/lua/cosmic/theme/integrated/onedark.lua +++ b/lua/cosmic/theme/integrated/onedark.lua @@ -4,7 +4,6 @@ local colors = { white = theme.fg, bg = theme.bg3, bg_highlight = theme.bg3, - statusline_bg = theme.bg0, normal = theme.green, insert = theme.cyan, command = theme.orange, diff --git a/lua/cosmic/theme/integrated/rose-pine.lua b/lua/cosmic/theme/integrated/rose-pine.lua index 290a476..a1ce6c2 100644 --- a/lua/cosmic/theme/integrated/rose-pine.lua +++ b/lua/cosmic/theme/integrated/rose-pine.lua @@ -4,7 +4,6 @@ local colors = { white = theme.text, bg = theme.surface, bg_highlight = theme.surface, - statusline_bg = theme.base, normal = theme.pine, insert = theme.foam, command = theme.gold, diff --git a/lua/cosmic/theme/integrated/tokyonight.lua b/lua/cosmic/theme/integrated/tokyonight.lua index 08f87ad..3a4902a 100644 --- a/lua/cosmic/theme/integrated/tokyonight.lua +++ b/lua/cosmic/theme/integrated/tokyonight.lua @@ -5,7 +5,6 @@ local colors = { white = themeColors.fg_dark, bg = themeColors.bg, bg_highlight = themeColors.bg_highlight, - statusline_bg = themeColors.bg_dark, normal = themeColors.blue, insert = themeColors.teal, command = themeColors.orange,