0

I started using lsp-zero for my Neovim but I am not able to accept the responses that it gives. I am able to see the suggestions, definitions, etc. perfectly. I am able to use the up and down arrow to move through the LSP suggestions dropdown. But I am not able to accept it.

Here is my lsp_config file. Please check and share how I can improve this.

Ideally I would like to press Enter and accept the LSP.

2
  • I am also facing the same problem and will love any lead on how to solve it Commented Aug 8 at 1:55
  • It would be nice to embed your code with appropriate style on your post for better response.
    – maxemilian
    Commented Aug 9 at 5:25

1 Answer 1

0

If you're using lsp-zero you might wanna give this a try if you haven't yet.
https://lsp-zero.netlify.app/docs/autocomplete.html#use-enter-to-confirm-completion

In essence, by default the selections from the suggested dropdowns can be confirmed using <C-y>, but you can also map something like Enter (<CR>) to it, using custom mappings.
I'm not entirely certain how the integration of below would look in your linked config, so here's just an example from my own .config/nvim/after/plugin/lsp.lua file

local cmp = require('cmp')

cmp.setup({
  -- There may be other settings in your setup too,  
  -- but below is what offers the custom mapping
  mapping = cmp.mapping.preset.insert({
      ['<CR>'] = cmp.mapping.confirm({select = true}),
  }),
})

The mapping section above e.g. just binds Enter to confirm the top suggested entry without having to select it. Likewise, setting it to false would simply mean you'd have to choose an entry in the list before being able to confirm using Enter.
I can at least confirm this to be working on my setup, also together with lsp-zero

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.