RubixDev / mason-update-all

Easily update all Mason packages with one command
GNU General Public License v3.0
16 stars 3 forks source link

mason-update-all

Easily update all Mason packages with one command.

Table of Contents

Requirements

Installation

Packer

use { 'RubixDev/mason-update-all' }

vim-plug

Plug 'RubixDev/mason-update-all'

Setup

require('mason-update-all').setup()

Commands

Events

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'

Updating from CLI

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'