nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

fix: cmdline fallback mapping for <S-Tab>

Open axieax opened this issue 4 years ago • 2 comments

Closes #953

axieax avatar May 02 '22 15:05 axieax

In my environment, this fix breaks <S-Tab> mapping.

I think the following keys is valid... WDYT?

    ['<Tab>'] = {
      c = function()
        local cmp = require('cmp')
        if cmp.visible() then
          cmp.select_next_item()
        elseif vim.fn.pumvisible() == 1 then
          feedkeys.call(keymap.t('<Tab>'), 'n')
        else
          feedkeys.call(keymap.t('<C-z><C-n>'), 'n')
        end
      end,
    },
    ['<S-Tab>'] = {
      c = function()
        local cmp = require('cmp')
        if cmp.visible() then
          cmp.select_prev_item()
        elseif vim.fn.pumvisible() == 1 then
          feedkeys.call(keymap.t('<S-Tab>'), 'n')
        else
          feedkeys.call(keymap.t('<C-z><C-p>'), 'n')
        end
      end,
    },

hrsh7th avatar May 02 '22 15:05 hrsh7th

Hmm in my environment <Tab> skips an entry (moves twice instead of once), and <S-Tab> still doesn't work for some reason.

https://user-images.githubusercontent.com/62098008/166261764-6ce5fa86-d135-4495-8942-480e10e36146.mp4

EDIT: forgot to attach my cmp config but it can be found here. filter_mode(mappings, "c") returns a dictionary which doesn't contain any mappings for <Tab>, or <S-Tab>.

axieax avatar May 02 '22 15:05 axieax