diff --git a/init.lua b/init.lua index 9e4cddb..5570e85 100644 --- a/init.lua +++ b/init.lua @@ -14,7 +14,7 @@ end if astronvim.default_colorscheme then if not pcall(vim.cmd.colorscheme, astronvim.default_colorscheme) then require("astronvim.utils").notify( - "Error setting up colorscheme: " .. astronvim.default_colorscheme, + ("Error setting up colorscheme: `%s`"):format(astronvim.default_colorscheme), vim.log.levels.ERROR ) end diff --git a/lua/astronvim/lazy.lua b/lua/astronvim/lazy.lua index 82f3e1d..35dd07a 100644 --- a/lua/astronvim/lazy.lua +++ b/lua/astronvim/lazy.lua @@ -22,7 +22,7 @@ if not vim.loop.fs_stat(lazypath) then vim.cmd.bw() vim.opt.cmdheight = oldcmdheight vim.tbl_map(function(module) pcall(require, module) end, { "nvim-treesitter", "mason" }) - require("astronvim.utils").notify "Mason is installing packages if configured, check status with :Mason" + require("astronvim.utils").notify "Mason is installing packages if configured, check status with `:Mason`" end, }) end diff --git a/lua/astronvim/utils/mason.lua b/lua/astronvim/utils/mason.lua index 3d08e0e..5cbd0e6 100644 --- a/lua/astronvim/utils/mason.lua +++ b/lua/astronvim/utils/mason.lua @@ -12,8 +12,8 @@ local M = {} local utils = require "astronvim.utils" -local notify = utils.notify local astroevent = utils.event +local function mason_notify(msg, type) utils.notify(msg, type, { title = "Mason" }) end --- Update specified mason packages, or just update the registries if no packages are listed ---@param pkg_names? string|string[] The package names as defined in Mason (Not mason-lspconfig or mason-null-ls) if the value is nil then it will just update the registries @@ -32,34 +32,34 @@ function M.update(pkg_names, auto_install) if success then local count = #updated_registries if vim.tbl_count(pkg_names) == 0 then - notify(("Successfully updated %d %s."):format(count, count == 1 and "registry" or "registries")) + mason_notify(("Successfully updated %d %s."):format(count, count == 1 and "registry" or "registries")) end for _, pkg_name in ipairs(pkg_names) do local pkg_avail, pkg = pcall(registry.get_package, pkg_name) if not pkg_avail then - notify(("Mason: %s is not available"):format(pkg_name), vim.log.levels.ERROR) + mason_notify(("`%s` is not available"):format(pkg_name), vim.log.levels.ERROR) else if not pkg:is_installed() then if auto_install then - notify(("Mason: Installing %s"):format(pkg.name)) + mason_notify(("Installing `%s`"):format(pkg.name)) pkg:install() else - notify(("Mason: %s not installed"):format(pkg.name), vim.log.levels.WARN) + mason_notify(("`%s` not installed"):format(pkg.name), vim.log.levels.WARN) end else pkg:check_new_version(function(update_available, version) if update_available then - notify(("Mason: Updating %s to %s"):format(pkg.name, version.latest_version)) - pkg:install():on("closed", function() notify(("Mason: Updated %s"):format(pkg.name)) end) + mason_notify(("Updating `%s` to %s"):format(pkg.name, version.latest_version)) + pkg:install():on("closed", function() mason_notify(("Updated %s"):format(pkg.name)) end) else - notify(("Mason: No updates available for %s"):format(pkg.name)) + mason_notify(("No updates available for `%s`"):format(pkg.name)) end end) end end end else - notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR) + mason_notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR) end end)) end @@ -72,7 +72,7 @@ function M.update_all() return end - notify "Mason: Checking for package updates..." + mason_notify "Checking for package updates..." registry.update(vim.schedule_wrap(function(success, updated_registries) if success then local installed_pkgs = registry.get_installed_packages() @@ -80,7 +80,7 @@ function M.update_all() local no_pkgs = running == 0 if no_pkgs then - notify "Mason: No updates available" + mason_notify "No updates available" astroevent "MasonUpdateCompleted" else local updated = false @@ -88,11 +88,11 @@ function M.update_all() pkg:check_new_version(function(update_available, version) if update_available then updated = true - notify(("Mason: Updating %s to %s"):format(pkg.name, version.latest_version)) + mason_notify(("Updating `%s` to %s"):format(pkg.name, version.latest_version)) pkg:install():on("closed", function() running = running - 1 if running == 0 then - notify "Mason: Update Complete" + mason_notify "Update Complete" astroevent "MasonUpdateCompleted" end end) @@ -100,9 +100,9 @@ function M.update_all() running = running - 1 if running == 0 then if updated then - notify "Mason: Update Complete" + mason_notify "Update Complete" else - notify "Mason: No updates available" + mason_notify "No updates available" end astroevent "MasonUpdateCompleted" end @@ -111,7 +111,7 @@ function M.update_all() end end else - notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR) + mason_notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR) end end)) end diff --git a/lua/astronvim/utils/updater.lua b/lua/astronvim/utils/updater.lua index 68d84e0..9b5e268 100644 --- a/lua/astronvim/utils/updater.lua +++ b/lua/astronvim/utils/updater.lua @@ -75,7 +75,7 @@ end function M.version(quiet) local version = astronvim.install.version or git.current_version(false) or "unknown" if astronvim.updater.options.channel ~= "stable" then version = ("nightly (%s)"):format(version) end - if version and not quiet then notify("Version: " .. version) end + if version and not quiet then notify(("Version: *%s*"):format(version)) end return version end @@ -147,7 +147,7 @@ function M.update_available(opts) -- if the git command is not available, then throw an error if not git.available() then notify( - "git command is not available, please verify it is accessible in a command line. This may be an issue with your PATH", + "`git` command is not available, please verify it is accessible in a command line. This may be an issue with your `PATH`", vim.log.levels.ERROR ) return diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index e48e499..518badf 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -97,7 +97,7 @@ return { vim.api.nvim_echo(messages, false, {}) local result = results[vim.fn.getcharstr()] if result and result.val and result.val ~= "" then - vim.notify("Copied: " .. result.val) + utils.notify(("Copied: `%s`"):format(result.val)) vim.fn.setreg("+", result.val) end end,