Easily update all Mason packages with one command.
use { 'RubixDev/mason-update-all' }Plug 'RubixDev/mason-update-all'Call the setup function with optional settings overrides. The default values are shown below.
require('mason-update-all').setup({
-- Whether a notification should be shown when there are no updates.
show_no_updates_notification = true,
}):MasonUpdateAll— update all installed Mason packages
Upon completion of all updates the user event MasonUpdateAllComplete will be emitted. You can use it like so:
vim.api.nvim_create_autocmd('User', {
pattern = 'MasonUpdateAllComplete',
callback = function()
print('mason-update-all has finished')
end,
})or in VimScript:
autocmd User MasonUpdateAllComplete echo 'mason-update-all has finished'Using the provided vim command and user event, it is possible to update the Mason packages from the command line or shell scripts.
# Update Packer plugins
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
# Update Mason packages
nvim --headless -c 'autocmd User MasonUpdateAllComplete quitall' -c 'MasonUpdateAll'