From 1ad219916ddd4a77b7caa6252311d0b1cd67cf32 Mon Sep 17 00:00:00 2001 From: Jay Patel <36803168+jay-babu@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:57:18 -0500 Subject: [PATCH] feat: add NoneLs* commands --- README.md | 2 ++ lua/mason-null-ls/api/command.lua | 32 +++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4ac52ab..8aea896 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,9 @@ Plug 'jay-babu/mason-null-ls.nvim' Available after calling `setup`. - `:NullLsInstall [...]` - installs the provided sources +- `:NoneLsInstall [...]` - installs the provided sources - `:NullLsUninstall ...` - uninstalls the provided sources +- `:NoneLsUninstall ...` - uninstalls the provided sources # Configuration diff --git a/lua/mason-null-ls/api/command.lua b/lua/mason-null-ls/api/command.lua index 647ddcf..0cd7588 100644 --- a/lua/mason-null-ls/api/command.lua +++ b/lua/mason-null-ls/api/command.lua @@ -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() @@ -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()