-
Notifications
You must be signed in to change notification settings - Fork 297
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Make sure you have done the following
- Updated to the latest version of
blink.cmp
- Searched for existing issues and documentation (try
<C-k>
on https://cmp.saghen.dev)
Bug Description
I noticed this when I was trying to play around with vim.on_key
.
init.lua
vim.pack.add({
{ src = "https://github.com/Saghen/blink.cmp", version = "v1.6.0" },
})
require("blink.cmp").setup({
keymap = {
preset = "default",
["<CR>"] = { "accept", "fallback" },
},
})
vim.on_key(function(_, typed)
if vim.fn.keytrans(typed) == "<CR>" then
print(vim.api.nvim_get_current_line())
end
end)
snippets/package.json
{
"name": "snippets",
"contributes": {
"snippets": [
{
"language": "lua",
"path": "./lua.json"
}
]
}
}
snippets/lua.json
{
"Print table": {
"prefix": [
"pp"
],
"body": [
"print(vim.inspect($0))"
]
}
}
Use this config along with this snippet config, and try to select the completion item with <CR>
. Notice that the printed text in vim.on_key
callback is the expanded snippet print(vim.inspect($0))
.
I would expect this to be the text on the line before expanding the snippet
Reading the documentation for vim.on_key
:
Function invoked for every input key, after mappings have been applied but before further processing.
it seems like it should be called before the keymap is processed and the snippet is expanded. Am I misunderstanding the docs for this?
neovim
version
NVIM v0.12.0-dev-1119+g582e0714b5
blink.cmp
version
v1.6.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working