From 739b2931a2ca1ab5eef9686311990e58d55e34a3 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Fri, 23 Jun 2023 12:20:33 +0200 Subject: add command to toggle null ls source --- lua/alpha/lsp/null-ls.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lua') diff --git a/lua/alpha/lsp/null-ls.lua b/lua/alpha/lsp/null-ls.lua index 6b9edc8..75d8293 100644 --- a/lua/alpha/lsp/null-ls.lua +++ b/lua/alpha/lsp/null-ls.lua @@ -38,3 +38,16 @@ vim.keymap.set({ "n", "v" }, "vca", vim.lsp.buf.code_action, {desc = "LS vim.keymap.set("n", "vf", function() return vim.lsp.buf.format { async = true } end, {desc = "LSP (null ls) Format file"}) + +-- function to toogle and possible restart it +vim.api.nvim_create_user_command("NullLsToggle", function() + local sources = vim.tbl_map(function(el) + return el.name + end, null_ls.get_sources()) + vim.ui.select(sources, {}, function(selected) + if not selected then + return + end + null_ls.toggle(selected) + end) +end, {}) -- cgit v1.2.3