nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

Ctrl-N doesn't work for buffers

Open chiefjester opened this issue 1 year ago • 1 comments

FAQ

  • [X] 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: https://github.com/LazyVim/LazyVim/issues/4414

chiefjester avatar Sep 11 '24 16:09 chiefjester

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.

dpetka2001 avatar Sep 11 '24 17:09 dpetka2001