Skip to content

Commit

Permalink
feat: add NoneLs* commands (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-babu authored Nov 26, 2023
1 parent ae0c5fa commit 7f474eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ Plug 'jay-babu/mason-null-ls.nvim'
Available after calling `setup`.

- `:NullLsInstall [<source>...]` - installs the provided sources
- `:NoneLsInstall [<source>...]` - installs the provided sources
- `:NullLsUninstall <source> ...` - uninstalls the provided sources
- `:NoneLsUninstall <source> ...` - uninstalls the provided sources

# Configuration

Expand Down
32 changes: 18 additions & 14 deletions lua/mason-null-ls/api/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ local NullLsInstall = a.scope(function(sources)
end
end)

vim.api.nvim_create_user_command('NullLsInstall', function(opts)
NullLsInstall(opts.fargs)
end, {
desc = 'Install one or more Null-ls sources.',
nargs = '*',
complete = 'custom,v:lua.mason_null_ls_completion.available_source_completion',
})
for _, command in ipairs({ 'NullLsInstall', 'NoneLsInstall' }) do
vim.api.nvim_create_user_command(command, function(opts)
NullLsInstall(opts.fargs)
end, {
desc = 'Install one or more Null-ls sources.',
nargs = '*',
complete = 'custom,v:lua.mason_null_ls_completion.available_source_completion',
})
end

local function NullLsUninstall(sources)
require('mason.ui').open()
Expand All @@ -126,13 +128,15 @@ local function NullLsUninstall(sources)
end
end

vim.api.nvim_create_user_command('NullLsUninstall', function(opts)
NullLsUninstall(opts.fargs)
end, {
desc = 'Uninstall one or more Null-ls sources.',
nargs = '+',
complete = 'custom,v:lua.mason_null_ls_completion.installed_source_completion',
})
for _, command in ipairs({ 'NullLsUninstall', 'NoneLsUninstall' }) do
vim.api.nvim_create_user_command(command, function(opts)
NullLsUninstall(opts.fargs)
end, {
desc = 'Uninstall one or more Null-ls sources.',
nargs = '+',
complete = 'custom,v:lua.mason_null_ls_completion.installed_source_completion',
})
end

_G.mason_null_ls_completion = {
available_source_completion = function()
Expand Down

0 comments on commit 7f474eb

Please sign in to comment.