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

Completion on confirmation

Open yueyingjuesha opened this issue 2 years ago • 7 comments

I am wondering if there is a configuration that can auto select the first entry whenever I start typing characters For example I currently use

  completion = { completeopt = 'menu,menuone,noinsert' }, -- pre select the first one

to do the trick, but it seems like when I hit <CR> on the pre select item, it doesn't auto expand to the full entry, just the character I entered, which is different from what I see in normal editor area

yueyingjuesha avatar Apr 14 '22 21:04 yueyingjuesha

Same here. Have to tab twice to get the single item selected from the list, which is a bit annoying.

appelgriebsch avatar Jun 03 '22 08:06 appelgriebsch

Same problem.

lkschu avatar Jul 01 '22 08:07 lkschu

You must set

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

segln avatar Jul 01 '22 15:07 segln

You must set

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

No, setting this configuration only works on editor area, it doesn't work on the cmd line status line

yueyingjuesha avatar Jul 02 '22 03:07 yueyingjuesha

How about this?

    mapping = {                
        ['<CR>'] = cmp.mapping(cmp.mapping.confirm({ select = true }), { 'i', 'c' })      
    },    

segln avatar Jul 02 '22 05:07 segln

The above works fine. However, for very short (and frequent) commands such as :q, :w, :wq or :qa, the completion is a bit annoying. Is there a way to disable completion when the input starts with w or q? Or maybe set a min character limit?

thibthib18 avatar Jan 24 '23 16:01 thibthib18

The best here would be to have completion be aware of shorthands available for commands. It should show w just like it sows write. Also I found out that you can <C-CR> to confirm whatever is in your command line without triggering completion.

SirWrexes avatar Jul 02 '23 12:07 SirWrexes