From d9bc0bbc4c01f6ca8c6b27065d496e0926d3c90f Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 14 Feb 2023 00:57:05 +0100 Subject: Refactor --- lua/no-clown-fiesta/groups/alpha.lua | 2 +- lua/no-clown-fiesta/groups/git.lua | 2 +- lua/no-clown-fiesta/groups/highlights.lua | 24 ++++++++---------------- lua/no-clown-fiesta/groups/hop.lua | 2 +- lua/no-clown-fiesta/groups/init.lua | 17 +++++++++++++++++ lua/no-clown-fiesta/groups/lazy.lua | 2 +- lua/no-clown-fiesta/groups/lir.lua | 2 +- lua/no-clown-fiesta/groups/lsp.lua | 30 +++++++++++++++++++++--------- lua/no-clown-fiesta/groups/markdown.lua | 2 +- lua/no-clown-fiesta/groups/neogit.lua | 2 +- lua/no-clown-fiesta/groups/nvim-cmp.lua | 2 +- lua/no-clown-fiesta/groups/nvim-tree.lua | 2 +- lua/no-clown-fiesta/groups/statusline.lua | 2 +- lua/no-clown-fiesta/groups/telescope.lua | 2 +- lua/no-clown-fiesta/groups/treesitter.lua | 16 +++++++--------- lua/no-clown-fiesta/groups/whichkey.lua | 2 +- 16 files changed, 65 insertions(+), 46 deletions(-) create mode 100644 lua/no-clown-fiesta/groups/init.lua (limited to 'lua/no-clown-fiesta/groups') diff --git a/lua/no-clown-fiesta/groups/alpha.lua b/lua/no-clown-fiesta/groups/alpha.lua index 167019a..402fbc4 100644 --- a/lua/no-clown-fiesta/groups/alpha.lua +++ b/lua/no-clown-fiesta/groups/alpha.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { AlphaHeader = { fg = palette.gray_blue }, AlphaButtons = { fg = palette.medium_gray }, diff --git a/lua/no-clown-fiesta/groups/git.lua b/lua/no-clown-fiesta/groups/git.lua index 4c71de3..66323d2 100644 --- a/lua/no-clown-fiesta/groups/git.lua +++ b/lua/no-clown-fiesta/groups/git.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { SignAdd = { fg = palette.sign_add }, SignChange = { fg = palette.sign_change }, diff --git a/lua/no-clown-fiesta/groups/highlights.lua b/lua/no-clown-fiesta/groups/highlights.lua index b0cd74a..b2bf6f2 100644 --- a/lua/no-clown-fiesta/groups/highlights.lua +++ b/lua/no-clown-fiesta/groups/highlights.lua @@ -1,10 +1,10 @@ local M = {} -function M.highlight(palette, options) +function M.highlight(palette, opts) return { Normal = { fg = palette.fg, - bg = options.transparent and palette.none or palette.bg, + bg = opts.transparent and palette.none or palette.bg, }, SignColumn = { bg = palette.bg }, MsgArea = { fg = palette.fg, bg = palette.bg }, @@ -22,7 +22,7 @@ function M.highlight(palette, options) Comment = vim.tbl_extend( "force", { fg = palette.medium_gray }, - options.styles.comments + opts.styles.comments ), Folded = { fg = palette.light_gray, bg = palette.alt_bg }, FoldColumn = { fg = palette.light_gray, bg = palette.alt_bg }, @@ -67,11 +67,7 @@ function M.highlight(palette, options) Question = { fg = palette.cyan }, EndOfBuffer = { fg = palette.bg }, NonText = { fg = palette.bg }, - Variable = vim.tbl_extend( - "force", - { fg = palette.white }, - options.styles.variables - ), + Variable = vim.tbl_extend("force", { fg = palette.white }, opts.styles.variables), String = { fg = palette.medium_gray_blue }, Character = { fg = palette.green }, Constant = { fg = palette.white }, @@ -79,17 +75,13 @@ function M.highlight(palette, options) Boolean = { fg = palette.red }, Float = { fg = palette.red }, Identifier = { fg = palette.white }, - Function = vim.tbl_extend("force", { fg = palette.cyan }, options.styles.functions), + Function = vim.tbl_extend("force", { fg = palette.cyan }, opts.styles.functions), Operator = { fg = palette.white }, - Type = vim.tbl_extend("force", { fg = palette.white }, options.styles.type), + Type = vim.tbl_extend("force", { fg = palette.white }, opts.styles.type), StorageClass = { fg = palette.gray_blue }, Structure = { fg = palette.gray_blue }, Typedef = { fg = palette.white }, - Keyword = vim.tbl_extend( - "force", - { fg = palette.gray_blue }, - options.styles.keywords - ), + Keyword = vim.tbl_extend("force", { fg = palette.gray_blue }, opts.styles.keywords), Statement = { fg = palette.gray_blue }, Conditional = { fg = palette.gray_blue }, Repeat = { fg = palette.gray_blue }, @@ -108,7 +100,7 @@ function M.highlight(palette, options) SpecialComment = vim.tbl_extend( "force", { fg = palette.medium_gray }, - options.styles.comments + opts.styles.comments ), Underlined = { underline = true }, Bold = { bold = true }, diff --git a/lua/no-clown-fiesta/groups/hop.lua b/lua/no-clown-fiesta/groups/hop.lua index caa16b2..65e0dab 100644 --- a/lua/no-clown-fiesta/groups/hop.lua +++ b/lua/no-clown-fiesta/groups/hop.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { HopNextKey = { fg = palette.cyan, bold = true }, HopNextKey1 = { fg = palette.red, bold = true }, diff --git a/lua/no-clown-fiesta/groups/init.lua b/lua/no-clown-fiesta/groups/init.lua new file mode 100644 index 0000000..7e81328 --- /dev/null +++ b/lua/no-clown-fiesta/groups/init.lua @@ -0,0 +1,17 @@ +return { + require "no-clown-fiesta.groups.alpha", + require "no-clown-fiesta.groups.git", + require "no-clown-fiesta.groups.highlights", + require "no-clown-fiesta.groups.hop", + require "no-clown-fiesta.groups.lazy", + require "no-clown-fiesta.groups.lir", + require "no-clown-fiesta.groups.lsp", + require "no-clown-fiesta.groups.markdown", + require "no-clown-fiesta.groups.neogit", + require "no-clown-fiesta.groups.nvim-cmp", + require "no-clown-fiesta.groups.nvim-tree", + require "no-clown-fiesta.groups.statusline", + require "no-clown-fiesta.groups.telescope", + require "no-clown-fiesta.groups.treesitter", + require "no-clown-fiesta.groups.whichkey", +} diff --git a/lua/no-clown-fiesta/groups/lazy.lua b/lua/no-clown-fiesta/groups/lazy.lua index 2922cd7..850f2f8 100644 --- a/lua/no-clown-fiesta/groups/lazy.lua +++ b/lua/no-clown-fiesta/groups/lazy.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { LazyButton = { fg = palette.fg }, LazyButtonActive = { fg = palette.orange, bg = palette.accent }, diff --git a/lua/no-clown-fiesta/groups/lir.lua b/lua/no-clown-fiesta/groups/lir.lua index 47071b7..d0579ca 100644 --- a/lua/no-clown-fiesta/groups/lir.lua +++ b/lua/no-clown-fiesta/groups/lir.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { LirFloatNormal = { fg = palette.fg, bg = palette.alt_bg }, LirDir = { fg = palette.white }, diff --git a/lua/no-clown-fiesta/groups/lsp.lua b/lua/no-clown-fiesta/groups/lsp.lua index face8d3..553ec2c 100644 --- a/lua/no-clown-fiesta/groups/lsp.lua +++ b/lua/no-clown-fiesta/groups/lsp.lua @@ -1,26 +1,38 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { LspReferenceRead = { bg = "#36383F" }, LspReferenceText = { bg = "#36383F" }, LspReferenceWrite = { bg = "#36383f" }, - DiagnosticError = { fg = palette.error }, DiagnosticWarn = { fg = palette.warning }, DiagnosticInfo = { fg = palette.info }, DiagnosticHint = { fg = palette.hint }, - DiagnosticVirtualTextError = { fg = palette.error }, DiagnosticVirtualTextWarn = { fg = palette.warning }, DiagnosticVirtualTextInfo = { fg = palette.info }, DiagnosticVirtualTextHint = { fg = palette.hint }, - - DiagnosticUnderlineError = { undercurl = true, sp = palette.error }, - DiagnosticUnderlineWarn = { undercurl = true, sp = palette.warning }, - DiagnosticUnderlineInfo = { undercurl = true, sp = palette.info }, - DiagnosticUnderlineHint = { undercurl = true, sp = palette.hint }, - + DiagnosticUnderlineError = vim.tbl_extend( + "force", + { sp = palette.error }, + opts.styles.lsp + ), + DiagnosticUnderlineWarn = vim.tbl_extend( + "force", + { sp = palette.warning }, + opts.styles.lsp + ), + DiagnosticUnderlineInfo = vim.tbl_extend( + "force", + { sp = palette.info }, + opts.styles.lsp + ), + DiagnosticUnderlineHint = vim.tbl_extend( + "force", + { sp = palette.hint }, + opts.styles.lsp + ), LspSignatureActiveParameter = { bg = palette.alt_bg, bold = true }, LspCodeLens = { fg = palette.comment }, } diff --git a/lua/no-clown-fiesta/groups/markdown.lua b/lua/no-clown-fiesta/groups/markdown.lua index 6147a25..3c282a4 100644 --- a/lua/no-clown-fiesta/groups/markdown.lua +++ b/lua/no-clown-fiesta/groups/markdown.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { markdownBlockquote = { fg = palette.accent }, markdownBold = { fg = palette.yellow, bold = true }, diff --git a/lua/no-clown-fiesta/groups/neogit.lua b/lua/no-clown-fiesta/groups/neogit.lua index 14d9fb1..511d1c9 100644 --- a/lua/no-clown-fiesta/groups/neogit.lua +++ b/lua/no-clown-fiesta/groups/neogit.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { NeogitNotificationInfo = { fg = palette.sign_add }, NeogitNotificationWarning = { fg = palette.warning }, diff --git a/lua/no-clown-fiesta/groups/nvim-cmp.lua b/lua/no-clown-fiesta/groups/nvim-cmp.lua index 364af5b..4f188e2 100644 --- a/lua/no-clown-fiesta/groups/nvim-cmp.lua +++ b/lua/no-clown-fiesta/groups/nvim-cmp.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { CmpItemAbbr = { fg = palette.fg }, CmpItemAbbrDeprecated = { fg = palette.red }, diff --git a/lua/no-clown-fiesta/groups/nvim-tree.lua b/lua/no-clown-fiesta/groups/nvim-tree.lua index c110435..53fb408 100644 --- a/lua/no-clown-fiesta/groups/nvim-tree.lua +++ b/lua/no-clown-fiesta/groups/nvim-tree.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { NvimTreeFolderIcon = { fg = palette.white }, NvimTreeIndentMarker = { fg = palette.alt_bg }, diff --git a/lua/no-clown-fiesta/groups/statusline.lua b/lua/no-clown-fiesta/groups/statusline.lua index ede108a..759ec61 100644 --- a/lua/no-clown-fiesta/groups/statusline.lua +++ b/lua/no-clown-fiesta/groups/statusline.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { StatusLine = { fg = palette.gray, bg = palette.bg }, StatusLineNC = { fg = palette.alt_bg, bg = palette.alt_bg }, diff --git a/lua/no-clown-fiesta/groups/telescope.lua b/lua/no-clown-fiesta/groups/telescope.lua index 71c4aaa..b32086b 100644 --- a/lua/no-clown-fiesta/groups/telescope.lua +++ b/lua/no-clown-fiesta/groups/telescope.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { TelescopeNormal = { fg = palette.fg, bg = palette.bg }, TelescopeSelection = { fg = palette.fg, bg = palette.accent }, diff --git a/lua/no-clown-fiesta/groups/treesitter.lua b/lua/no-clown-fiesta/groups/treesitter.lua index b7cee4a..dce369b 100644 --- a/lua/no-clown-fiesta/groups/treesitter.lua +++ b/lua/no-clown-fiesta/groups/treesitter.lua @@ -1,18 +1,16 @@ local M = {} -local unpack = unpack - -function M.highlight(palette, options) +function M.highlight(palette, opts) return { ["@comment"] = vim.tbl_extend( "force", { fg = palette.medium_gray }, - options.styles.comments + opts.styles.comments ), ["@annotation"] = { fg = palette.white }, ["@attribute"] = { fg = palette.white }, ["@constructor"] = { fg = palette.cyan }, - ["@type"] = vim.tbl_extend("force", { fg = palette.white }, options.styles.type), + ["@type"] = vim.tbl_extend("force", { fg = palette.white }, opts.styles.type), ["@type.builtin"] = { fg = palette.white }, ["@conditional"] = { fg = palette.gray_blue }, ["@exception"] = { fg = palette.red }, @@ -20,12 +18,12 @@ function M.highlight(palette, options) ["@keyword"] = vim.tbl_extend( "force", { fg = palette.gray_blue }, - options.styles.keywords + opts.styles.keywords ), ["@keyword.function"] = vim.tbl_extend( "force", { fg = palette.gray_blue }, - options.styles.keywords + opts.styles.keywords ), ["@label"] = { fg = palette.white }, ["@namespace"] = { fg = palette.white }, @@ -40,7 +38,7 @@ function M.highlight(palette, options) ["@function"] = vim.tbl_extend( "force", { fg = palette.cyan }, - options.styles.functions + opts.styles.functions ), ["@function.builtin"] = { fg = palette.cyan }, ["@method"] = { fg = palette.cyan }, @@ -49,7 +47,7 @@ function M.highlight(palette, options) ["@variable"] = vim.tbl_extend( "force", { fg = palette.white }, - options.styles.variables + opts.styles.variables ), ["@variable.builtin"] = { fg = palette.white }, ["@property"] = { fg = palette.white }, diff --git a/lua/no-clown-fiesta/groups/whichkey.lua b/lua/no-clown-fiesta/groups/whichkey.lua index 66ac153..6af4936 100644 --- a/lua/no-clown-fiesta/groups/whichkey.lua +++ b/lua/no-clown-fiesta/groups/whichkey.lua @@ -1,6 +1,6 @@ local M = {} -function M.highlight(palette) +function M.highlight(palette, opts) return { WhichKey = { fg = palette.light_gray }, WhichKeySeperator = { fg = palette.gray }, -- cgit v1.2.3-70-g09d2