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

CmpStatus is not displayed fully when run inside a keymap #1512

Open
2 tasks done
gregorias opened this issue Apr 8, 2023 · 2 comments
Open
2 tasks done

CmpStatus is not displayed fully when run inside a keymap #1512

gregorias opened this issue Apr 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@gregorias
Copy link

FAQ

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

Announcement

Minimal reproducible full config

-- | Fetches Lazy if not present.
local function bootstrap_lazy()
	local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
	if not vim.loop.fs_stat(lazypath) then
		vim.fn.system({
			"git",
			"clone",
			"--filter=blob:none",
			"https://github.com/folke/lazy.nvim.git",
			"--branch=stable",
			lazypath,
		})
	end
	vim.opt.rtp:prepend(lazypath)
end
bootstrap_lazy()

require("lazy").setup({
	{
		"hrsh7th/nvim-cmp",
		dependencies = { "hrsh7th/cmp-buffer" },
		config = function()
			local cmp = require("cmp")
			cmp.setup({ sources = cmp.config.sources({ { name = "buffer" } }) })
		end,
	},
})

vim.keymap.set("n", "<space>c", function()
	vim.api.nvim_cmd({ cmd = "CmpStatus" }, {})
end)

Description

CmpStatus is not displayed fully when run inside a keymap. The user needs to press enter to get the status fed to them.

Steps to reproduce

  1. Open a file with Neovim, e.g., nvim .config/nvim/init.lua.
  2. Press <space>c

Expected behavior

Selecting CmpStatus in Legendary runs the command and displays the full status:

image

Actual behavior

You need to press enter 3-4 times to get the full output of CmpStatus, line by line.

Additional context

No response

@uga-rosa
Copy link
Contributor

uga-rosa commented Apr 10, 2023

This is not a bug in cmp, but a specify in nvim_echo.
The following can be reproduced regardless of cmp.

vim.keymap.set('n', '<Space>c', function()
  for _ = 1, 10 do
    vim.api.nvim_echo({ { 'hi\n', 'Normal' } }, false, {})
  end
end)

@gregorias
Copy link
Author

Huh, thanks @uga-rosa.

I found neovim/neovim#22478, which, when completed, should address this issue in nvim-cmp.

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