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

Ctrl-N doesn't work for buffers #2036

Open
2 tasks done
chiefjester opened this issue Sep 11, 2024 · 1 comment
Open
2 tasks done

Ctrl-N doesn't work for buffers #2036

chiefjester opened this issue Sep 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chiefjester
Copy link

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

Here's repro.lua , nvim -u ~/repro.lua

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"hrsh7th/nvim-cmp",
			dependencies = {
				"hrsh7th/cmp-nvim-lsp",
				"hrsh7th/cmp-buffer",
				"hrsh7th/cmp-path",
			},
			opts = function(_, opts)
				local cmp = require("cmp")
				opts.mapping = cmp.mapping.preset.insert({
					["<C-Space>"] = cmp.mapping.complete(),
				})
				opts.sources = cmp.config.sources({
					{ name = "nvim_lsp" },
					{ name = "path" },
				}, {
					{ name = "buffer" },
				})
			end,
		},
	},
})

Description

Ctrl N doesn't work with new buffers, seems like cmp.mapping.complete(), is the cause?

Steps to reproduce

  1. Make a new File, then type anything, eg, apple
    
  2. type :sp foo.txt
    
  3. Type ap
    
  4. Press Ctrl-N
    

Expected behavior

It should pick up apple on the other buffer as source of completion

Actual behavior

Nothing Happens

Additional context

If you comment this line, it works:

-- opts.mapping = cmp.mapping.preset.insert({
--  ["<C-Space>"] = cmp.mapping.complete(),
-- })

Reference issue filed in LazyVim:
LazyVim/LazyVim#4414

@chiefjester chiefjester added the bug Something isn't working label Sep 11, 2024
@dpetka2001
Copy link

I believe this is neither a LazyVim bug nor a nvim-cmp bug. Please see comment here and kindly correct me if I'm somewhere mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants