fix(formatting): stylua

dev
Pocco81 2 years ago
parent 60c3dc2424
commit 1ec2590301

@ -6,8 +6,8 @@ config.options = {
term_colors = false, term_colors = false,
compile = { compile = {
enable = false, enable = false,
path = vim.fn.stdpath "cache" .. "/catppuccin", path = vim.fn.stdpath("cache") .. "/catppuccin",
suffix = "_compiled" suffix = "_compiled",
}, },
dim_inactive = { dim_inactive = {
enable = false, enable = false,

@ -1,19 +1,18 @@
local M = {} local M = {}
function M.get() function M.get()
local hi = { local hi = {
IndentBlanklineChar = { fg = cp.surface0 }, IndentBlanklineChar = { fg = cp.surface0 },
IndentBlanklineContextChar = { fg = cp.text }, IndentBlanklineContextChar = { fg = cp.text },
} }
if cnf.integrations.indent_blankline.colored_indent_levels then if cnf.integrations.indent_blankline.colored_indent_levels then
hi["IndentBlanklineIndent6"] = {blend = 0, fg = cp.yellow} hi["IndentBlanklineIndent6"] = { blend = 0, fg = cp.yellow }
hi["IndentBlanklineIndent5"] = {blend = 0, fg = cp.red} hi["IndentBlanklineIndent5"] = { blend = 0, fg = cp.red }
hi["IndentBlanklineIndent4"] = {blend = 0, fg = cp.teal} hi["IndentBlanklineIndent4"] = { blend = 0, fg = cp.teal }
hi["IndentBlanklineIndent3"] = {blend = 0, fg = cp.peach} hi["IndentBlanklineIndent3"] = { blend = 0, fg = cp.peach }
hi["IndentBlanklineIndent2"] = {blend = 0, fg = cp.blue} hi["IndentBlanklineIndent2"] = { blend = 0, fg = cp.blue }
hi["IndentBlanklineIndent1"] = {blend = 0, fg = cp.pink} hi["IndentBlanklineIndent1"] = { blend = 0, fg = cp.pink }
end end
return hi return hi

@ -11,27 +11,26 @@ local function get_prepared()
end end
function M.get() function M.get()
if not get_prepared() then if not get_prepared() then
local catppuccin = require("catppuccin") local catppuccin = require("catppuccin")
if catppuccin.after_loading ~= nil then if catppuccin.after_loading ~= nil then
catppuccin.after_loading = function () catppuccin.after_loading = function()
catppuccin.after_loading() catppuccin.after_loading()
require'leap'.init_highlight(true) require("leap").init_highlight(true)
end end
else else
catppuccin.after_loading = function () catppuccin.after_loading = function()
require'leap'.init_highlight(true) require("leap").init_highlight(true)
end end
end end
set_prepared(true) set_prepared(true)
end end
return { return {
LeapLabelPrimary = {bg = cp.surface1, fg = cp.text}, LeapLabelPrimary = { bg = cp.surface1, fg = cp.text },
LeapLabelSecondary = {bg = cp.surface1, fg = cp.text}, LeapLabelSecondary = { bg = cp.surface1, fg = cp.text },
LeapBackdrop = {bg = cp.base, fg = cp.overlay0}, LeapBackdrop = { bg = cp.base, fg = cp.overlay0 },
LeapMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, LeapMatch = { bg = cp.base, fg = cp.red, style = { "underline" } },
} }
end end

@ -11,33 +11,32 @@ local function get_prepared()
end end
function M.get() function M.get()
if not get_prepared() then if not get_prepared() then
set_prepared(vim.api.nvim_create_autocmd("User", { set_prepared(vim.api.nvim_create_autocmd("User", {
pattern = "CatppuccinLoaded", pattern = "CatppuccinLoaded",
callback = function () callback = function()
if pcall(require, "lightspeed") then if pcall(require, "lightspeed") then
require("lightspeed").init_highlight() require("lightspeed").init_highlight()
end end
end end,
})) }))
end end
return { return {
LightspeedLabel = {bg = cp.surface1, fg = cp.text}, LightspeedLabel = { bg = cp.surface1, fg = cp.text },
LightspeedOverlapped = {bg = cp.surface1, fg = cp.text}, LightspeedOverlapped = { bg = cp.surface1, fg = cp.text },
LightspeedLabelDistant = {bg = cp.mauve, fg = cp.text}, LightspeedLabelDistant = { bg = cp.mauve, fg = cp.text },
LightspeedLabelDistantOverlapped = {bg = cp.mauve, fg = cp.text}, LightspeedLabelDistantOverlapped = { bg = cp.mauve, fg = cp.text },
LightspeedShortcut = {bg = cp.base, fg = cp.peach, style = { "italic" }}, LightspeedShortcut = { bg = cp.base, fg = cp.peach, style = { "italic" } },
LightspeedShortcutOverlapped = {bg = cp.base, fg = cp.peach, style = { "bold" }}, LightspeedShortcutOverlapped = { bg = cp.base, fg = cp.peach, style = { "bold" } },
LightspeedMaskedChar = {bg = cp.base, fg = cp.red, style = { "undercurl" }}, LightspeedMaskedChar = { bg = cp.base, fg = cp.red, style = { "undercurl" } },
LightspeedGreyWash = {bg = cp.base, fg = cp.overlay0}, LightspeedGreyWash = { bg = cp.base, fg = cp.overlay0 },
LightspeedUnlabeledMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, LightspeedUnlabeledMatch = { bg = cp.base, fg = cp.red, style = { "underline" } },
LightspeedOneCharMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, LightspeedOneCharMatch = { bg = cp.base, fg = cp.red, style = { "underline" } },
LightspeedUniqueChar = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, LightspeedUniqueChar = { bg = cp.base, fg = cp.green, style = { "strikethrough" } },
LightspeedPendingOpArea = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, LightspeedPendingOpArea = { bg = cp.base, fg = cp.green, style = { "strikethrough" } },
LightspeedPendingChangeOpArea = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, LightspeedPendingChangeOpArea = { bg = cp.base, fg = cp.green, style = { "strikethrough" } },
LightspeedCursor = {fg = cp.base, bg = cp.text}, LightspeedCursor = { fg = cp.base, bg = cp.text },
} }
end end

@ -2,7 +2,6 @@ local M = {}
local ucolors = require("catppuccin.utils.colors") local ucolors = require("catppuccin.utils.colors")
function M.get() function M.get()
local options = require("catppuccin.config").options local options = require("catppuccin.config").options
local virtual_text = options.integrations.native_lsp.virtual_text local virtual_text = options.integrations.native_lsp.virtual_text
local underlines = options.integrations.native_lsp.underlines local underlines = options.integrations.native_lsp.underlines
@ -22,10 +21,26 @@ function M.get()
LspReferenceWrite = { bg = cp.surface1 }, -- used for highlighting "write" references LspReferenceWrite = { bg = cp.surface1 }, -- used for highlighting "write" references
-- hightlight diagnostics in numberline -- hightlight diagnostics in numberline
DiagnosticVirtualTextError = { bg = ucolors.darken(error, darkening_percentage, cp.base), fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticVirtualTextError = {
DiagnosticVirtualTextWarn = { bg = ucolors.darken(warning, darkening_percentage, cp.base), fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default bg = ucolors.darken(error, darkening_percentage, cp.base),
DiagnosticVirtualTextInfo = { bg = ucolors.darken(info, darkening_percentage, cp.base), fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default fg = error,
DiagnosticVirtualTextHint = { bg = ucolors.darken(hint, darkening_percentage, cp.base), fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default style = virtual_text.errors,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextWarn = {
bg = ucolors.darken(warning, darkening_percentage, cp.base),
fg = warning,
style = virtual_text.warnings,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextInfo = {
bg = ucolors.darken(info, darkening_percentage, cp.base),
fg = info,
style = virtual_text.information,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextHint = {
bg = ucolors.darken(hint, darkening_percentage, cp.base),
fg = hint,
style = virtual_text.hints,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticError = { bg = cp.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticError = { bg = cp.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticWarn = { bg = cp.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default DiagnosticWarn = { bg = cp.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default

@ -9,7 +9,6 @@ function M.get()
root_dir_color = cp.blue root_dir_color = cp.blue
end end
return { return {
NvimTreeFolderName = { fg = cp.blue }, NvimTreeFolderName = { fg = cp.blue },
NvimTreeFolderIcon = { fg = cp.blue }, NvimTreeFolderIcon = { fg = cp.blue },

@ -7,8 +7,8 @@ function M.get()
TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = { "bold" } }, TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = { "bold" } },
TelescopeMatching = { fg = cp.blue }, TelescopeMatching = { fg = cp.blue },
TelescopePromptPrefix = { bg = cp.crust }, TelescopePromptPrefix = { bg = cp.crust },
TelescopePromptNormal = { bg = cp.crust}, TelescopePromptNormal = { bg = cp.crust },
TelescopeResultsNormal = { bg = cp.mantle}, TelescopeResultsNormal = { bg = cp.mantle },
TelescopePreviewNormal = { bg = cp.crust }, TelescopePreviewNormal = { bg = cp.crust },
TelescopePromptBorder = { bg = cp.crust, fg = cp.crust }, TelescopePromptBorder = { bg = cp.crust, fg = cp.crust },
TelescopeResultsBorder = { bg = cp.mantle, fg = cp.crust }, TelescopeResultsBorder = { bg = cp.mantle, fg = cp.crust },

@ -53,7 +53,7 @@ function M.get()
TSNote = { fg = cp.base, bg = cp.blue }, TSNote = { fg = cp.base, bg = cp.blue },
TSWarning = { fg = cp.base, bg = cp.yellow }, TSWarning = { fg = cp.base, bg = cp.yellow },
TSDanger = { fg = cp.base, bg = cp.red }, TSDanger = { fg = cp.base, bg = cp.red },
TSConstMacro = { fg = cp.mauve }; -- For constants that are defined by macros: NULL in cp. TSConstMacro = { fg = cp.mauve }, -- For constants that are defined by macros: NULL in cp.
-- TSError = { fg = cp.red }, -- For syntax/parser errors. -- TSError = { fg = cp.red }, -- For syntax/parser errors.
-- rustTSField = { fg = cp.surface1 }, -- For fields. -- rustTSField = { fg = cp.surface1 }, -- For fields.
TSLabel = { fg = cp.sapphire }, -- For labels: label: in C and :label: in Lua. TSLabel = { fg = cp.sapphire }, -- For labels: label: in C and :label: in Lua.

@ -1,6 +1,6 @@
local M = {} local M = {}
local flavours = {"latte", "frappe", "macchiato", "mocha"} local flavours = { "latte", "frappe", "macchiato", "mocha" }
local command = vim.api.nvim_create_user_command local command = vim.api.nvim_create_user_command
@ -11,14 +11,14 @@ command("Catppuccin", function(inp)
return return
end end
vim.g.catppuccin_flavour = inp.args vim.g.catppuccin_flavour = inp.args
vim.cmd "colorscheme catppuccin" vim.cmd("colorscheme catppuccin")
end, { end, {
nargs = 1, nargs = 1,
complete = function(line) complete = function(line)
return vim.tbl_filter(function(val) return vim.tbl_filter(function(val)
return vim.startswith(val, line) return vim.startswith(val, line)
end, flavours) end, flavours)
end end,
}) })
command("CatppuccinCompile", function() command("CatppuccinCompile", function()
@ -42,7 +42,9 @@ function M.load()
if config.compile.enable == true then if config.compile.enable == true then
local compiled_path = config.compile.path local compiled_path = config.compile.path
.. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/") .. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/")
.. vim.g.catppuccin_flavour .. config.compile.suffix .. ".lua" .. vim.g.catppuccin_flavour
.. config.compile.suffix
.. ".lua"
local f = io.open(compiled_path, "r") local f = io.open(compiled_path, "r")
if f ~= nil then if f ~= nil then
io.close(f) io.close(f)

@ -15,7 +15,8 @@ end
function util.compile() function util.compile()
local theme = require("catppuccin.lib.mapper").apply() local theme = require("catppuccin.lib.mapper").apply()
local lines = { [[ local lines = {
[[
-- This file is autogenerated by CATPPUCCIN. -- This file is autogenerated by CATPPUCCIN.
-- Do not make changes directly to this file. -- Do not make changes directly to this file.
@ -23,16 +24,17 @@ vim.cmd("hi clear")
if vim.fn.exists("syntax_on") then if vim.fn.exists("syntax_on") then
vim.cmd("syntax reset") vim.cmd("syntax reset")
end end
vim.g.colors_name = "catppuccin"]] } vim.g.colors_name = "catppuccin"]],
}
local config = require("catppuccin.config").options local config = require("catppuccin.config").options
local custom_highlights = config.custom_highlights local custom_highlights = config.custom_highlights
for property, value in pairs(theme.properties) do for property, value in pairs(theme.properties) do
if type(value) == "string" then if type(value) == "string" then
table.insert(lines, fmt('vim.o.%s = "%s"', property, value)) table.insert(lines, fmt('vim.o.%s = "%s"', property, value))
elseif type(value) == "bool" then elseif type(value) == "bool" then
table.insert(lines, fmt('vim.o.%s = %s', property, value)) table.insert(lines, fmt("vim.o.%s = %s", property, value))
elseif type(value) == "table" then elseif type(value) == "table" then
table.insert(lines, fmt('vim.o.%s = %s', property, inspect(value))) table.insert(lines, fmt("vim.o.%s = %s", property, inspect(value)))
end end
end end
local tbl = vim.tbl_deep_extend("keep", theme.integrations, theme.base) local tbl = vim.tbl_deep_extend("keep", theme.integrations, theme.base)
@ -61,19 +63,49 @@ vim.g.colors_name = "catppuccin"]] }
end end
if config.term_colors then if config.term_colors then
local colors = { "overlay0", "red", "green", "yellow", "blue", "pink", "sky", "text", "overlay1", "red", "green", "yellow", "blue", "pink", "sky", "text"} local colors = {
"overlay0",
"red",
"green",
"yellow",
"blue",
"pink",
"sky",
"text",
"overlay1",
"red",
"green",
"yellow",
"blue",
"pink",
"sky",
"text",
}
for i = 0, 15 do for i = 0, 15 do
table.insert(lines, fmt('vim.g.terminal_color_%d = "%s"', i, theme.terminal[colors[i + 1]])) table.insert(lines, fmt('vim.g.terminal_color_%d = "%s"', i, theme.terminal[colors[i + 1]]))
end end
end end
os.execute(string.format("mkdir %s %s", vim.loop.os_uname().sysname == 'Windows' and "" or "-p", config.compile.path)) os.execute(
local file = io.open(config.compile.path .. (vim.loop.os_uname().sysname == 'Windows' and "\\" or "/") .. vim.g.catppuccin_flavour .. config.compile.suffix .. ".lua", "w") string.format("mkdir %s %s", vim.loop.os_uname().sysname == "Windows" and "" or "-p", config.compile.path)
)
local file = io.open(
config.compile.path
.. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/")
.. vim.g.catppuccin_flavour
.. config.compile.suffix
.. ".lua",
"w"
)
file:write(table.concat(lines, "\n")) file:write(table.concat(lines, "\n"))
file:close() file:close()
end end
function util.clean() function util.clean()
local config = require("catppuccin.config").options local config = require("catppuccin.config").options
local compiled_path = config.compile.path .. (vim.loop.os_uname().sysname == 'Windows' and "\\" or "/") .. vim.g.catppuccin_flavour .. config.compile.suffix .. ".lua" local compiled_path = config.compile.path
.. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/")
.. vim.g.catppuccin_flavour
.. config.compile.suffix
.. ".lua"
os.remove(compiled_path) os.remove(compiled_path)
end end

@ -12,13 +12,13 @@ function M.get_palette()
end end
if type(cnf.color_overrides) == "table" then if type(cnf.color_overrides) == "table" then
for _, pal in pairs({"all", flvr}) do for _, pal in pairs({ "all", flvr }) do
if cnf.color_overrides[pal] ~= nil then if cnf.color_overrides[pal] ~= nil then
for k, v in pairs(cnf.color_overrides[pal]) do for k, v in pairs(cnf.color_overrides[pal]) do
if palette[k] then if palette[k] then
palette[k] = v palette[k] = v
else else
echo('"'..k .. '" is not a valid catppucin palette color', "warn") echo('"' .. k .. '" is not a valid catppucin palette color', "warn")
end end
end end
end end

@ -20,6 +20,6 @@ return function(msg, kind)
title = TITLE, title = TITLE,
}) })
else else
vim.notify(("%s (%s): %s"):format(TITLE, level.type,msg), level.log) vim.notify(("%s (%s): %s"):format(TITLE, level.type, msg), level.log)
end end
end end

Loading…
Cancel
Save