2

I use neovim and neovim-lsp-config with clangd.

The default keybind for code actions is <space>ca, after pressing which a menu pops up. Usually there is just one option, so having to choose it from the menu feels laborious. Luckily, the documentation states that you can pass a boolean flag apply, so that when there is just one option it is selected automatically.

So I tried to change the keybinding to following:

vim.keymap.set('n', '<space>ca', function()
    vim.lsp.buf.code_action({apply=true}) end, bufopts)

But the behavior does not change - the menu still appears. What am I doing wrong?

romainl
  • 22,554
  • 2
  • 49
  • 59
Phastasm
  • 121
  • 2
  • The question has been answered here: https://neovim.discourse.group/t/neovim-keybinding-for-lsp-code-action-with-options/3052 – Phastasm Dec 02 '22 at 15:20

0 Answers0