Skip to content

Commit

Permalink
fixup!: unify code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamir committed Oct 25, 2023
1 parent 9abf460 commit 2d4a0e7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lua/modules/configs/ui/lualine.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
return function()
local colorscheme = vim.g.colors_name
local _is_catppuccin = string.find(colorscheme, "catppuccin") ~= nil
local is_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
local colors = require("modules.utils").get_palette()
local icons = {
diagnostics = require("modules.utils.icons").get("diagnostics", true),
Expand All @@ -10,14 +9,13 @@ return function()
ui = require("modules.utils.icons").get("ui", true),
}

local function custom_theme(is_catppuccin)
local function custom_theme()
is_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
vim.api.nvim_create_autocmd("ColorScheme", {
group = vim.api.nvim_create_augroup("LualineColorScheme", { clear = true }),
pattern = "*",
callback = function()
local colorscheme_ = vim.g.colors_name
local is_catppuccin_ = string.find(colorscheme_, "catppuccin") ~= nil
require("lualine").setup({ options = { theme = custom_theme(is_catppuccin_) } })
require("lualine").setup({ options = { theme = custom_theme() } })
end,
})

Expand Down Expand Up @@ -144,7 +142,7 @@ return function()
return ""
end,
padding = 0,
color = _is_catppuccin and utils.gen_hl("surface1", true, true) or nil,
color = is_catppuccin and utils.gen_hl("surface1", true, true) or nil,
},

file_status = {
Expand Down Expand Up @@ -196,7 +194,7 @@ return function()
return next(available_servers) == nil and icons.misc.NoActiveLsp
or string.format("%s[%s]", icons.misc.LspAvailable, table.concat(available_servers, ", "))
end,
color = _is_catppuccin and utils.gen_hl("blue", true, true, nil, "bold") or nil,
color = is_catppuccin and utils.gen_hl("blue", true, true, nil, "bold") or nil,
cond = conditionals.has_enough_room,
},

Expand Down Expand Up @@ -225,7 +223,7 @@ return function()
end
return ""
end,
color = _is_catppuccin and utils.gen_hl("green", true, true) or nil,
color = is_catppuccin and utils.gen_hl("green", true, true) or nil,
cond = conditionals.has_enough_room,
},

Expand All @@ -240,7 +238,7 @@ return function()
function()
return icons.ui.FolderWithHeart .. utils.abbreviate_path(vim.fs.normalize(vim.fn.getcwd()))
end,
color = _is_catppuccin and utils.gen_hl("subtext0", true, true, nil, "bold") or nil,
color = is_catppuccin and utils.gen_hl("subtext0", true, true, nil, "bold") or nil,
},

file_location = {
Expand All @@ -264,7 +262,7 @@ return function()
require("modules.utils").load_plugin("lualine", {
options = {
icons_enabled = true,
theme = custom_theme(_is_catppuccin),
theme = custom_theme(),
disabled_filetypes = { statusline = { "alpha" } },
component_separators = "",
section_separators = { left = "", right = "" },
Expand All @@ -289,7 +287,7 @@ return function()
{
"branch",
icon = icons.git_nosep.Branch,
color = _is_catppuccin and utils.gen_hl("subtext0", true, true, nil, "bold") or nil,
color = is_catppuccin and utils.gen_hl("subtext0", true, true, nil, "bold") or nil,
cond = conditionals.has_git,
},
{
Expand All @@ -301,7 +299,7 @@ return function()
},
source = diff_source,
colored = false,
color = _is_catppuccin and utils.gen_hl("subtext0", true, true) or nil,
color = is_catppuccin and utils.gen_hl("subtext0", true, true) or nil,
cond = conditionals.has_git,
padding = { right = 1 },
},
Expand Down

0 comments on commit 2d4a0e7

Please sign in to comment.