mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-29 20:14:36 +02:00
feat(util): use lazy's notify instead of vim.notify
This commit is contained in:
parent
04a898a326
commit
48d1e8df12
2 changed files with 18 additions and 18 deletions
|
@ -1,10 +1,16 @@
|
||||||
|
local Util = require("lazy.core.util")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.autoformat = true
|
M.autoformat = true
|
||||||
|
|
||||||
function M.toggle()
|
function M.toggle()
|
||||||
M.autoformat = not M.autoformat
|
M.autoformat = not M.autoformat
|
||||||
vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save")
|
if M.autoformat then
|
||||||
|
Util.info("Enabled format on save", { title = "Format" })
|
||||||
|
else
|
||||||
|
Util.warn("Disabled format on save", { title = "Format" })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.format()
|
function M.format()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local Util = require("lazy.core.util")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.root_patterns = { ".git", "/lua" }
|
M.root_patterns = { ".git", "/lua" }
|
||||||
|
@ -95,19 +97,15 @@ function M.toggle(option, silent, values)
|
||||||
else
|
else
|
||||||
vim.opt_local[option] = values[1]
|
vim.opt_local[option] = values[1]
|
||||||
end
|
end
|
||||||
return vim.notify(
|
return Util.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" })
|
||||||
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
|
|
||||||
vim.log.levels.INFO,
|
|
||||||
{ title = "Option" }
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
vim.opt_local[option] = not vim.opt_local[option]:get()
|
vim.opt_local[option] = not vim.opt_local[option]:get()
|
||||||
if not silent then
|
if not silent then
|
||||||
vim.notify(
|
if vim.opt_local[option]:get() then
|
||||||
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
|
Util.info("Enabled " .. option, { title = "Option" })
|
||||||
vim.log.levels.INFO,
|
else
|
||||||
{ title = "Option" }
|
Util.warn("Disabled " .. option, { title = "Option" })
|
||||||
)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -116,19 +114,15 @@ function M.toggle_diagnostics()
|
||||||
enabled = not enabled
|
enabled = not enabled
|
||||||
if enabled then
|
if enabled then
|
||||||
vim.diagnostic.enable()
|
vim.diagnostic.enable()
|
||||||
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
Util.info("Enabled diagnostics", { title = "Diagnostics" })
|
||||||
else
|
else
|
||||||
vim.diagnostic.disable()
|
vim.diagnostic.disable()
|
||||||
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
Util.warn("Disabled diagnostics", { title = "Diagnostics" })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.deprecate(old, new)
|
function M.deprecate(old, new)
|
||||||
vim.notify(
|
Util.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), { title = "LazyVim" })
|
||||||
("`%s` is deprecated. Please use `%s` instead"):format(old, new),
|
|
||||||
vim.log.levels.WARN,
|
|
||||||
{ title = "LazyVim" }
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue