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 = {}
|
||||
|
||||
M.autoformat = true
|
||||
|
||||
function M.toggle()
|
||||
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
|
||||
|
||||
function M.format()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local Util = require("lazy.core.util")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.root_patterns = { ".git", "/lua" }
|
||||
|
@ -95,19 +97,15 @@ function M.toggle(option, silent, values)
|
|||
else
|
||||
vim.opt_local[option] = values[1]
|
||||
end
|
||||
return vim.notify(
|
||||
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Option" }
|
||||
)
|
||||
return Util.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" })
|
||||
end
|
||||
vim.opt_local[option] = not vim.opt_local[option]:get()
|
||||
if not silent then
|
||||
vim.notify(
|
||||
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Option" }
|
||||
)
|
||||
if vim.opt_local[option]:get() then
|
||||
Util.info("Enabled " .. option, { title = "Option" })
|
||||
else
|
||||
Util.warn("Disabled " .. option, { title = "Option" })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -116,19 +114,15 @@ function M.toggle_diagnostics()
|
|||
enabled = not enabled
|
||||
if enabled then
|
||||
vim.diagnostic.enable()
|
||||
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
||||
Util.info("Enabled diagnostics", { title = "Diagnostics" })
|
||||
else
|
||||
vim.diagnostic.disable()
|
||||
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
||||
Util.warn("Disabled diagnostics", { title = "Diagnostics" })
|
||||
end
|
||||
end
|
||||
|
||||
function M.deprecate(old, new)
|
||||
vim.notify(
|
||||
("`%s` is deprecated. Please use `%s` instead"):format(old, new),
|
||||
vim.log.levels.WARN,
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
Util.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), { title = "LazyVim" })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue