summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-02-14 00:57:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-02-14 00:57:05 +0100
commitd9bc0bbc4c01f6ca8c6b27065d496e0926d3c90f (patch)
tree6effdfdf9b0ca91c0fb5079b1d11158c9ea8f278
parent3e4b0088e0ecd494bc258b6f96d320e49d1cda30 (diff)
Refactor
-rw-r--r--lua/no-clown-fiesta/groups/alpha.lua2
-rw-r--r--lua/no-clown-fiesta/groups/git.lua2
-rw-r--r--lua/no-clown-fiesta/groups/highlights.lua24
-rw-r--r--lua/no-clown-fiesta/groups/hop.lua2
-rw-r--r--lua/no-clown-fiesta/groups/init.lua17
-rw-r--r--lua/no-clown-fiesta/groups/lazy.lua2
-rw-r--r--lua/no-clown-fiesta/groups/lir.lua2
-rw-r--r--lua/no-clown-fiesta/groups/lsp.lua30
-rw-r--r--lua/no-clown-fiesta/groups/markdown.lua2
-rw-r--r--lua/no-clown-fiesta/groups/neogit.lua2
-rw-r--r--lua/no-clown-fiesta/groups/nvim-cmp.lua2
-rw-r--r--lua/no-clown-fiesta/groups/nvim-tree.lua2
-rw-r--r--lua/no-clown-fiesta/groups/statusline.lua2
-rw-r--r--lua/no-clown-fiesta/groups/telescope.lua2
-rw-r--r--lua/no-clown-fiesta/groups/treesitter.lua16
-rw-r--r--lua/no-clown-fiesta/groups/whichkey.lua2
-rw-r--r--lua/no-clown-fiesta/init.lua54
-rw-r--r--lua/no-clown-fiesta/settings.lua7
-rw-r--r--lua/no-clown-fiesta/util.lua10
19 files changed, 82 insertions, 100 deletions
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 },
diff --git a/lua/no-clown-fiesta/init.lua b/lua/no-clown-fiesta/init.lua
index 8b72320..8bad306 100644
--- a/lua/no-clown-fiesta/init.lua
+++ b/lua/no-clown-fiesta/init.lua
@@ -1,15 +1,15 @@
local M = {}
-function M.setup(options)
+function M.setup(opts)
local settings = require "no-clown-fiesta.settings"
- if options then
- settings.set(options)
+ if opts then
+ settings.set(opts)
end
end
function M.load()
local settings = require "no-clown-fiesta.settings"
- local options = settings.options
+ local opts = settings.opts
vim.api.nvim_command "hi clear"
if vim.fn.exists "syntax_on" then
@@ -22,49 +22,11 @@ function M.load()
local util = require "no-clown-fiesta.util"
local palette = require "no-clown-fiesta.palette"
- local highlights = require("no-clown-fiesta.groups.highlights").highlight(
- palette,
- options
- )
+ local groups = require "no-clown-fiesta.groups"
- local alpha = require("no-clown-fiesta.groups.alpha").highlight(palette)
- local git = require("no-clown-fiesta.groups.git").highlight(palette)
- local hop = require("no-clown-fiesta.groups.hop").highlight(palette)
- local lazy = require("no-clown-fiesta.groups.lazy").highlight(palette)
- local lir = require("no-clown-fiesta.groups.lir").highlight(palette)
- local lsp = require("no-clown-fiesta.groups.lsp").highlight(palette)
- local markdown = require("no-clown-fiesta.groups.markdown").highlight(palette)
- local neogit = require("no-clown-fiesta.groups.neogit").highlight(palette)
- local nvimtree = require("no-clown-fiesta.groups.nvim-tree").highlight(palette)
- local nvimcmp = require("no-clown-fiesta.groups.nvim-cmp").highlight(palette)
- local statusline = require("no-clown-fiesta.groups.statusline").highlight(palette)
- local telescope = require("no-clown-fiesta.groups.telescope").highlight(palette)
- local treesitter = require("no-clown-fiesta.groups.treesitter").highlight(
- palette,
- options
- )
- local whichkey = require("no-clown-fiesta.groups.whichkey").highlight(palette)
-
- local skeletons = {
- alpha,
- git,
- hop,
- highlights,
- lazy,
- lir,
- lsp,
- markdown,
- neogit,
- nvimtree,
- nvimcmp,
- statusline,
- telescope,
- treesitter,
- whichkey,
- }
-
- for _, skeleton in ipairs(skeletons) do
- util.initialise(skeleton)
+ for _, group in ipairs(groups) do
+ group = group.highlight(palette, opts)
+ util.initialise(group)
end
end
diff --git a/lua/no-clown-fiesta/settings.lua b/lua/no-clown-fiesta/settings.lua
index 78f78ad..827a80c 100644
--- a/lua/no-clown-fiesta/settings.lua
+++ b/lua/no-clown-fiesta/settings.lua
@@ -8,13 +8,14 @@ local DEFAULT = {
functions = {},
variables = {},
type = { bold = true },
+ lsp = { underline = true },
},
}
-M.options = {}
+M.opts = {}
-function M.set(options)
- M.options = vim.tbl_deep_extend("force", DEFAULT, options or {})
+function M.set(opts)
+ M.opts = vim.tbl_deep_extend("force", DEFAULT, opts or {})
end
M.set()
diff --git a/lua/no-clown-fiesta/util.lua b/lua/no-clown-fiesta/util.lua
index 46e66d3..e88d742 100644
--- a/lua/no-clown-fiesta/util.lua
+++ b/lua/no-clown-fiesta/util.lua
@@ -1,12 +1,12 @@
local M = {}
-local function highlight(group, properties)
- vim.api.nvim_set_hl(0, group, properties)
+local function highlight(name, value)
+ vim.api.nvim_set_hl(0, name, value)
end
-function M.initialise(skeleton)
- for group, properties in pairs(skeleton) do
- highlight(group, properties)
+function M.initialise(group)
+ for name, value in pairs(group) do
+ highlight(name, value)
end
end