Hitting enter with ghost text causes strange error
Make sure you have done the following
- [x] Updated to the latest version of
blink.cmp - [x] Searched for existing issues and documentation (try
<C-k>on https://cmp.saghen.dev)
Bug Description
Hey, I'm getting an error from Blink related to ghost text. This happens every time i hit "enter" when the ghost text is present. I just want a new line but it throws an error and opens a calculator command. I did not even know nvim had a calculator!
I'm happy to provide more information but I'm not sure what's helpful. Thanks so much for the great plugin! It really makes things fast!
Relevant configuration
return {
'saghen/blink.cmp',
dependencies = {
{ 'L3MON4D3/LuaSnip', version = 'v2.*' },
{ 'giuxtaposition/blink-cmp-copilot' },
},
keymap = {
preset = 'none',
['<C-l>'] = { 'accept', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },
['<C-p>'] = { 'select_prev', 'fallback' },
},
enabled = function()
return not vim.tbl_contains({ "markdown" }, vim.bo.filetype) and
not vim.tbl_contains({ "copilot-chat" }, vim.bo.filetype) and
not vim.tbl_contains({ "codecompanion" }, vim.bo.filetype)
end,
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = 'mono',
},
completion = {
ghost_text = {
enabled = true,
show_without_selection = true,
show_with_menu = true,
show_without_menu = true,
},
},
snippets = { preset = 'luasnip' },
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' },
providers = {
copilot = {
name = "copilot",
module = "blink-cmp-copilot",
score_offset = 100,
async = true,
transform_items = function(ctx, items)
for _, item in ipairs(items) do
item.kind_icon = ''
item.kind_name = 'Copilot'
end
return items
end
},
},
},
fuzzy = { implementation = "prefer_rust_with_warning" }
},
opts_extend = { "sources.default" }
}
neovim version
0.11.0
blink.cmp version
54cbaac2064fe6
Could you be a bit more specific about the steps to reproduce this?
I’m not able to reproduce the issue with the minimal environment below. If you could update it with any necessary config, I’ll take another look!
-- run via: `nvim -u repro.lua`
vim.env.LAZY_STDPATH = "/tmp/nvim-repro"
-- stylua: ignore
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()
require("lazy.minit").repro({
spec = {
{
"saghen/blink.cmp",
dependencies = {
{ "L3MON4D3/LuaSnip", version = "v2.*" },
{ "giuxtaposition/blink-cmp-copilot" },
{ "folke/noice.nvim", event = "VeryLazy", opts = {} },
},
opts = {
keymap = {
preset = "none",
["<C-l>"] = { "accept", "fallback" },
["<C-n>"] = { "select_next", "fallback" },
["<C-p>"] = { "select_prev", "fallback" },
},
enabled = function()
return not vim.tbl_contains({ "markdown" }, vim.bo.filetype)
and not vim.tbl_contains({ "copilot-chat" }, vim.bo.filetype)
and not vim.tbl_contains({ "codecompanion" }, vim.bo.filetype)
end,
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "mono",
},
completion = {
ghost_text = {
enabled = true,
show_without_selection = true,
show_with_menu = true,
show_without_menu = true,
},
},
snippets = { preset = "luasnip" },
sources = {
default = { "lsp", "path", "snippets", "buffer", "copilot" },
providers = {
copilot = {
name = "copilot",
module = "blink-cmp-copilot",
score_offset = 100,
async = true,
transform_items = function(_, items)
for _, item in ipairs(items) do
item.kind_icon = ""
item.kind_name = "Copilot"
end
return items
end,
},
},
},
fuzzy = { implementation = "prefer_rust_with_warning" },
},
},
},
})
Closing as stale
Hey, so sorry but I didn't see your reply on May 28. If it's not too late, I was able to isolate this as only occuring with "tpope/vim-eunuch" which seems really strange but the config is pasted below. Also, to get the bug to happen, it needs to be a new buffer. So you need to run nvim with the config and then do ":badd" and ":bn" and then it will happen. So weird!
-- run via: `nvim -u repro.lua`
vim.env.LAZY_STDPATH = "/tmp/nvim-repro"
-- stylua: ignore
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()
require("lazy.minit").repro({
spec = {
{
"saghen/blink.cmp",
dependencies = {
{ "L3MON4D3/LuaSnip", version = "v2.*" },
{ "giuxtaposition/blink-cmp-copilot" },
{ "folke/noice.nvim", event = "VeryLazy", opts = {} },
{ "tpope/vim-eunuch", event = "VeryLazy" },
},
opts = {
keymap = {
preset = "none",
["<C-l>"] = { "accept", "fallback" },
["<C-n>"] = { "select_next", "fallback" },
["<C-p>"] = { "select_prev", "fallback" },
},
enabled = function()
return not vim.tbl_contains({ "markdown" }, vim.bo.filetype)
and not vim.tbl_contains({ "copilot-chat" }, vim.bo.filetype)
and not vim.tbl_contains({ "codecompanion" }, vim.bo.filetype)
end,
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "mono",
},
completion = {
ghost_text = {
enabled = true,
show_without_selection = true,
show_with_menu = true,
show_without_menu = true,
},
},
snippets = { preset = "luasnip" },
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
copilot = {
name = "copilot",
module = "blink-cmp-copilot",
score_offset = 100,
async = true,
transform_items = function(_, items)
for _, item in ipairs(items) do
item.kind_icon = ""
item.kind_name = "Copilot"
end
return items
end,
},
},
},
fuzzy = { implementation = "prefer_rust_with_warning" },
},
},
},
})
I am still not able to reproduce the issue with your updated config and with different Neovim versions (nightly, 0.11, and 0.10). Would you mind sharing a video of your steps? Maybe I am doing something wrong.
Sure. I'm on nvim 0.11 and MacOS in case that matters. Here's the video:
https://github.com/user-attachments/assets/10cb1daa-47f7-4952-a7c9-1ef5bab16374
Thanks for the quick response!