diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-06-23 12:20:33 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-06-23 12:20:33 +0200 |
| commit | 739b2931a2ca1ab5eef9686311990e58d55e34a3 (patch) | |
| tree | cbd19cf8598f169536426a075030c9d8894a0a03 /lua | |
| parent | 401cc2e41af890e19cc060f3bd28e15f34023377 (diff) | |
| download | nvim-conf-739b2931a2ca1ab5eef9686311990e58d55e34a3.tar.gz nvim-conf-739b2931a2ca1ab5eef9686311990e58d55e34a3.zip | |
add command to toggle null ls source
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/alpha/lsp/null-ls.lua | 13 |
1 files changed, 13 insertions, 0 deletions
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" }, "<leader>vca", vim.lsp.buf.code_action, {desc = "LS vim.keymap.set("n", "<leader>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, {}) |