blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Key map with suffix not work

Open Kaiser-Yang opened this issue 2 months ago • 1 comments

Make sure you have done the following

  • [X] I have updated to the latest version of blink.cmp
  • [X] I have read the README

Bug Description

I've mapped ;<space> to some functionality in insert mode, then I update the keymap to accept the second item.

I can not accept the second item unless I remove the ;<space> keymap:

Input something first:

image

Input ;, it seems to waif for updatetime to determine it's single key or continuous key:

image

After that, nothing happend, event the ; is not inserted:

image

Relevant configuration

local mapped_punc = {
    [','] = ',',
    ['.'] = '。',
    [':'] = ':',
    [';'] = ';',
    ['?'] = '?',
    ['\\'] = '、'
}
local function feed_key_helper(k, v)
    if v == nil or k == v then
        feedkeys(k, 'n')
    else
        feedkeys(v, 'm')
    end
end
            map.set({ 'i' }, k .. '<space>', function()
                feed_key_helper(v, v)
            end, opts())

keymap = {
                [';'] = {
                    -- FIX: can not work when binding ;<space> to other key
                    function(cmp)
                        if not vim.g.rime_enabled then return false end
                        local items = require('blink.cmp.completion.list').items
                        local rime_item_index = get_n_rime_item_index(2, items)
                        if #rime_item_index ~= 2 then return false end
                        return cmp.accept({ index = rime_item_index[2] })
                    end, 'fallback' },
}

neovim version

NVIM v0.10.1

blink.cmp version: branch, tag, or commit

v0.8.1

Kaiser-Yang avatar Dec 22 '24 05:12 Kaiser-Yang