hrsh7th/nvim-cmp

<cr> mapping breaks abbreviations

Open

#103 建立於 2021年8月27日

在 GitHub 查看
 (11 留言) (3 反應) (0 負責人)Lua (437 fork)batch import
bugdifficulthelp wantedreproduced

倉庫指標

Star
 (9,420 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

I don't think this is necessarily related to cmp, but I wanted to report it on the off chance it is or someone here knows how to fix it.

When I use any mapping for <cr>, my abbreviations stop working when using <cr> as the "non-keyword" character. I get this when using the suggested mapping like:

    ['<CR>'] = cmp.mapping.confirm({
      behavior = cmp.ConfirmBehavior.Insert,
      select = true,
    }),

but also in my more complicated mapping here.

An example would be to add this to your config:

iabbrev TODO TODO(jawa)

The expected behavior is in an empty document, in INSERT mode, type TODO then <cr>. This should cause the abbreviation to be expanded to TODO(jawa) with the cursor now on the next line.

This doesn't happen when I have the <cr> mapping specified, I just get TODO followed by the newline.

I tried adding vim.fn.feedkeys(t '<c-]><cr>') in my custom mapping function (instead of fallback()), which worked, but broke other things and wasn't something I could keep in place.

Any ideas would be much appreciated.

貢獻者指南