Skip to content

Key map with suffix not work #713

Closed as not planned
Closed as not planned
@Kaiser-Yang

Description

@Kaiser-Yang

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkeymap

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions