hrsh7th / cmp-cmdline

nvim-cmp source for vim's cmdline
MIT License
566 stars 45 forks source link

Completion on confirmation #42

Open yueyingjuesha opened 2 years ago

yueyingjuesha commented 2 years ago

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 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

appelgriebsch commented 2 years ago

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

lkschu commented 2 years ago

Same problem.

segln commented 2 years ago

You must set

mapping = {                    
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  }
yueyingjuesha commented 2 years ago

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

segln commented 2 years ago

How about this?

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

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?

SirWrexes commented 1 year ago

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.