refactor: simplify notification formatting implementation
This commit is contained in:
@@ -135,22 +135,7 @@ end
|
||||
---@param type number|nil The type of the notification (:help vim.log.levels)
|
||||
---@param opts? table The nvim-notify options to use (:help notify-options)
|
||||
function M.notify(msg, type, opts)
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
msg,
|
||||
type,
|
||||
M.extend_tbl({
|
||||
title = "AstroNvim",
|
||||
on_open = function(win)
|
||||
pcall(require, "nvim-treesitter")
|
||||
vim.wo[win].spell = false
|
||||
vim.wo[win].conceallevel = 3
|
||||
vim.wo[win].concealcursor = "n"
|
||||
pcall(vim.treesitter.start, vim.api.nvim_win_get_buf(win), "markdown")
|
||||
end,
|
||||
}, opts)
|
||||
)
|
||||
end)
|
||||
vim.schedule(function() vim.notify(msg, type, M.extend_tbl({ title = "AstroNvim" }, opts)) end)
|
||||
end
|
||||
|
||||
--- Trigger an AstroNvim user event
|
||||
|
||||
+6
-1
@@ -53,8 +53,13 @@ return {
|
||||
opts = {
|
||||
on_open = function(win)
|
||||
vim.api.nvim_win_set_config(win, { zindex = 175 })
|
||||
-- close notification immediately if notifications disabled
|
||||
if not vim.g.ui_notifications_enabled then vim.api.nvim_win_close(win, true) end
|
||||
if require("astronvim.utils").is_available "nvim-treesitter" then
|
||||
if not package.loaded["nvim-treesitter"] then require "nvim-treesitter" end
|
||||
vim.wo[win].conceallevel = 3
|
||||
vim.bo[vim.api.nvim_win_get_buf(win)].filetype = "markdown"
|
||||
vim.wo[win].spell = false
|
||||
end
|
||||
end,
|
||||
},
|
||||
config = require "plugins.configs.notify",
|
||||
|
||||
Reference in New Issue
Block a user