nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
16.93k stars 17.04k forks source link

no key combination accepts autocomplete suggestion #866

Closed alanifotis closed 2 months ago

alanifotis commented 2 months ago

Describe the bug

no key combination accepts autocomplete suggestion I've tried enter & enter + ctrl/shift/alt nothing makes it possible to accept the autocomplete

https://github.com/nvim-lua/kickstart.nvim/assets/44728074/6f849992-8d5b-4765-bb73-7d3743ee3538

PS. sorry if i'm opening this issue in the wrong place

To Reproduce

  1. Fresh build of neovim and I installed kickstart
  2. No matter in what language and lsp(even with the ones included in the init.lua)
  3. Try pressing on the autocomplete suggestion no way to accept it
  4. I can freely move to another suggestion
  5. English isn't my first language and maybe I am not using the correct terminology but you can see it better in the video 😅😅

Desktop

Neovim Version

:version NVIM v0.10.0-dev-2947+ge1ca7a7bf Build type: RelWithDebInfo LuaJIT 2.1.1710088188 Run ":verbose version" for more info

dduyanhhoang commented 2 months ago

Meet the same problem in Powershell on Windows 11 and also on WSL (Ubuntu LTS) (both on windows terminal) using the current version of kickstart nvim. I have already check the prerequisites (git, make, unzip, gcc, ripgrep) and language installation.

feoh commented 2 months ago

Folks, do you have any language servers installed?

Type :Mason to get started.

dduyanhhoang commented 2 months ago
image

@feoh Yes. Currently I use nvim for python. Same problem with clangd when I was using kickstart on wsl.

dam9000 commented 2 months ago

This is a recurring question, duplicates:

https://github.com/nvim-lua/kickstart.nvim/issues/816 Autocomplete keybindings not functioning as before

https://github.com/nvim-lua/kickstart.nvim/issues/851 How to use Autocomplete

And the answer is, the keymap was changed in the recent rewrite from <enter> to <c-y> so ctrl-y to confirm a autocomplete selection. Try if that works.

If you don't like the c-y keymap, here is how to restore to the previous "classic" keymaps:

diff --git a/init.lua b/init.lua
index 62d2c5c..ce2abb6 100644
--- a/init.lua
+++ b/init.lua
@@ -720,6 +720,11 @@ require('lazy').setup({
           --  This will expand snippets if the LSP sent a snippet.
           ['<C-y>'] = cmp.mapping.confirm { select = true },

+          -- Classic completion keymaps
+          ['<CR>'] = cmp.mapping.confirm { select = true },
+          ['<Tab>'] = cmp.mapping.select_next_item(),
+          ['<S-Tab>'] = cmp.mapping.select_prev_item(),
+
           -- Manually trigger a completion from nvim-cmp.
           --  Generally you don't need this, because nvim-cmp will display
           --  completions whenever it has completion options available.

For more info: https://github.com/hrsh7th/nvim-cmp?tab=readme-ov-file#recommended-configuration https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings

@feoh should we add that as a commented-out example? Should I open such a PR?

dduyanhhoang commented 2 months ago

It does do the work. Thanks @dam9000 . I'll try to read the init before positing more question.

alanifotis commented 2 months ago

Thank you @dam9000 for your help i will close the issue now