Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cycle through autocompletion options? #31

Open
CCLDArjun opened this issue Aug 24, 2022 · 1 comment
Open

How to cycle through autocompletion options? #31

CCLDArjun opened this issue Aug 24, 2022 · 1 comment

Comments

@CCLDArjun
Copy link

I have this config:

require'cmp'.setup {
  sources = {
    { name = 'nvim_lsp' }
  }
}

local custom_attach = function(client, bufnr)
 -- this code gets executed when a language server is attached to a buffer
 -- you can add your keybindings and commands here.
end

-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)

local capabilities = require('cmp_nvim_lsp').update_capabilities(
  vim.lsp.protocol.make_client_capabilities()
)


vim.cmd [[packadd packer.nvim]]
require('packer').startup(function(use)
	use 'wbthomason/packer.nvim'
	use 'neovim/nvim-lspconfig'
end)

require'lspconfig'.pyright.setup {
  on_attach = custom_attach,
  capabilities = capabilities
}

require'lspconfig'.pyright.setup {
  on_attach = custom_attach,
  capabilities = capabilities
}
require'lspconfig'.rust_analyzer.setup {
  on_attach = custom_attach,
  capabilities = capabilities
}

it's using lspconfig. I can see the lsp autocompletion options but I'm not able to cycle through or select them. Hitting tab inserts a space character and ctrl-n or ctrl-p opens the vim autocomplete.

@ghost
Copy link

ghost commented Sep 4, 2022

Hey mate, if you follow the example mappings that are provided in the nvim-cmp wiki, you should be able to find the key mappings that you need! Here's a link:

https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip

Keep in mind that the keybindings are specific to the snippet engine that you're using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant