fix: echo and replaced all prints with it

dev
Pocco81 2 years ago
parent f9a412002f
commit f67244f8f1

@ -1,6 +1,7 @@
local M = {}
local cnf = require("catppuccin.config").options
local echo = require("catppuccin.utils.echo")
function M.get_palette()
local flvr = vim.g.catppuccin_flavour
@ -17,11 +18,7 @@ function M.get_palette()
if palette[k] then
palette[k] = v
else
vim.api.nvim_echo(
{ { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } },
true,
{}
)
echo('Warning: "' .. k .. '" is not a valid catppucin palette color')
end
end
end

@ -8,7 +8,6 @@ local latte = require("catppuccin.core.palettes.latte")
function M.dim()
if cnf.dim_inactive.shade == "dark" then
print(vim.g.catppuccin_flavour)
return ucolors.vary_color(
{ latte = ucolors.darken(latte.base, dim_percentage, latte.mantle) },
ucolors.darken(cp.base, dim_percentage, cp.mantle)

@ -1,21 +1,25 @@
local TITLE = "Catppuccin"
return function(msg, level)
return function(msg, kind)
local has_notify_plugin = pcall(require, "notify")
local level = {}
if level == "error" then
level = vim.log.levels.ERROR
elseif level == "warn" then
level = vim.log.levels.WARN
if kind == "error" then
level.log = vim.log.kinds.ERROR
level.type = "error"
elseif kind == "warn" then
level.log = vim.log.kinds.WARN
level.type = "error"
else
level = level or vim.log.levels.INFO
level.log = kind or vim.log.kinds.INFO
level.type = "info"
end
if has_notify_plugin then
vim.notify(msg, level, {
vim.notify(msg, level.log, {
title = TITLE,
})
else
vim.notify(("[%s] %s"):format(TITLE, msg), level)
vim.notify(("%s (%s): %s"):format(TITLE, level.type,msg), level.log)
end
end

Loading…
Cancel
Save