refactor: simplify notification formatting implementation

This commit is contained in:
Micah Halter
2023-07-06 15:29:37 -04:00
parent 7fc032d5a2
commit 26d148e45c
2 changed files with 7 additions and 17 deletions
+1 -16
View File
@@ -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
View File
@@ -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",