Repository: nvim-lua/kickstart.nvim

Issue #816: Autocomplete keybindings not functioning as before
Created: 2024-03-31T06:55:48Z
Describe the bug
Migrated to a new computer and installed nvim kickstart. Expected tab and enter keys to work with autocomplete as with my previous setup (using commit a005f15cec8072c97201f86e15df62c7e4a4490e) . Instead they produce a tab and a newline respectively.


To Reproduce

Open a code file of your choice and try to use autocomplete
Tab key not switching between the autocomplete options, but produces a tab.
Enter key not applying autocomplete, but produces a newline.

Desktop


OS: MacOS
Terminal: Alacritty

Neovim Version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Duplicate issue #866: no key combination accepts autocomplete suggestion
Created: 2024-04-20T01:09:36Z
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

  
    
    

    autocomplete.mp4
    
  

  

  


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


Fresh build of neovim and I installed kickstart
No matter in what language and lsp(even with the ones included in the init.lua)
Try pressing on the autocomplete suggestion no way to accept it
I can freely move to another suggestion
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


OS: tried on windows and linux
Terminal: windows terminal/ gnome terminal, kitty and alacrity

Neovim Version

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

Closing comment (2024-04-20T16:24:49Z): This is a recurring question, duplicates:
#816  Autocomplete keybindings not functioning as before
#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?