[help] How do I select completion from lsp ?
fadhilsaheer opened this issue · 9 comments
Ik, I'm dumb, no need to say that again.
I'm from vscode, I've no idea how to use vim, I manage to set this up, lsp works fine, but cant i select from autocompletion ? pressing enter
is creating a new line.., I'm from shit world (vscode), how does this work in chad world ?
Press Enter or Ctrl + y can also do the same, Just pressing enter works for me , Check your lsp.lua file again
I changed the mappings inside lsp.lua
:
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
['<Tab>'] = cmp.mapping.select_next_item(cmp_select),
['<Enter>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
})
With this I can go through the suggestions with tab or CTRL+j, go back up with CTRL+k, confirm with enter and toggle the suggestions with CTRL+space
Compare with my config , https://github.com/anon-marvin/NeoChad/blob/main/after/plugin/lsp.lua
Compare with my config , https://github.com/anon-marvin/NeoChad/blob/main/after/plugin/lsp.lua
Good idea. I have copied the tab part. But it threw an error.
chatGPT fixed the error:
local has_words_before = function()
local line_nr, col_nr = unpack(vim.api.nvim_win_get_cursor(0))
local line = vim.api.nvim_buf_get_lines(0, line_nr - 1, line_nr, true)[1]
return col_nr ~= 0 and line:sub(col_nr, col_nr):match("%s") == nil
end
Press Enter or Ctrl + y can also do the same, Just pressing enter works for me , Check your lsp.lua file again
The enter key was working for me previously, but I recently did a fresh install of neovim and it stopped working. Also the lua snip is not showing up. I guess that's the issue with lsp-zero.
Press Enter or Ctrl + y can also do the same, Just pressing enter works for me , Check your lsp.lua file again
The enter key was working for me previously, but I recently did a fresh install of neovim and it stopped working. Also the lua snip is not showing up. I guess that's the issue with lsp-zero.
Try my config , git clone https://github.com/anon-marvin/NeoChad ~/.config/nvim
Press Enter or Ctrl + y can also do the same, Just pressing enter works for me , Check your lsp.lua file again
The enter key was working for me previously, but I recently did a fresh install of neovim and it stopped working. Also the lua snip is not showing up. I guess that's the issue with lsp-zero.
Try my config , git clone https://github.com/anon-marvin/NeoChad ~/.config/nvim
It was working for me till today. Until I did the complete reinstallation removing cache and everything
Press Enter or Ctrl + y can also do the same, Just pressing enter works for me , Check your lsp.lua file again
The enter key was working for me previously, but I recently did a fresh install of neovim and it stopped working. Also the lua snip is not showing up. I guess that's the issue with lsp-zero.
Try my config , git clone https://github.com/anon-marvin/NeoChad ~/.config/nvim
It was working for me till today. Until I did the complete reinstallation removing cache and everything
Lsp-zero been causing issues to me , no removed it
@anon-marvin I figured it out, you just have to put this line in your lsp.lua file
require('luasnip.loaders.from_vscode').lazy_load()