From 9f16f36b8b0d032abb01f5869519f65c659cf7a1 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 2 Jan 2025 11:35:43 +0100 Subject: [PATCH] chore(neovim): add keybinding to open yaml-companion select ui --- modules/home-manager/cli/neovim/files/lspconfig.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/home-manager/cli/neovim/files/lspconfig.lua b/modules/home-manager/cli/neovim/files/lspconfig.lua index 8f261b1..a7df681 100644 --- a/modules/home-manager/cli/neovim/files/lspconfig.lua +++ b/modules/home-manager/cli/neovim/files/lspconfig.lua @@ -171,7 +171,7 @@ lspconfig.yamlls.setup{cfg} vim.api.nvim_create_autocmd('LspAttach', { desc = 'LSP actions', - callback = function() + callback = function(ev) local bufmap = function(mode, lhs, rhs) local opts = {buffer = true} vim.keymap.set(mode, lhs, rhs, opts) @@ -213,5 +213,9 @@ vim.api.nvim_create_autocmd('LspAttach', { -- Move to the next diagnostic bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client.name == "yamlls" then + bufmap ('n', '', 'lua require("yaml-companion").open_ui_select()') + end end })