Skip to content

Keymap fallback doesn't handle script mappings #714

Open
@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 use jiangmiao/auto-pairs for auto close the braces and auto delete the close brace when deleting the open one, and auto indent after typing <cr>.

I use the below configuration for this plugin with lazy:

{
    'jiangmiao/auto-pairs',
    event = {'InsertEnter'},
    -- init = function() require'plugin_config/autopairs_config' end,
    -- lazy.nvim fails to load, we must initialize auto-pairs manually
    config = function()
        vim.cmd[[call AutoPairsTryInit()]]
    end,
},

This plugin will add some buffer type keybindings, for example the <cr> will be binded like this:

i  <CR>        &@<CR><SNR>76_AutoPairsReturn
	Last set from ~/.local/share/nvim/lazy/auto-pairs/plugin/auto-pairs.vim line 662

Then I use keymap in blink to bind <cr>:

keymap = {
    ['<cr>'] = { 'accept', 'fallback' },
}

After I press enter without selecting an item, I get this:

image

In order to make it work properly, now I just remove the buffer map <cr> when loading autopairs, and use a global mapping to map <cr> with auto indent functionality:

map.set({ 'i' }, '<cr>', '<c-g>u<cr><c-r>=AutoPairsReturn()<cr>', opts())

Relevant configuration

No response

neovim version

NVIM v0.10.1

blink.cmp version: branch, tag, or commit

v0.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogLikely not getting to it anytime soonbugSomething isn't workingkeymap

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions