wilder.nvim icon indicating copy to clipboard operation
wilder.nvim copied to clipboard

Add option to select first item in but not insert it

Open mawkler opened this issue 4 years ago • 6 comments

I would love it if Wilder automatically selected the first item in the suggestion list but without inserting its text into the command-line. And calling wilder#accept_completion() would insert the text in the selected suggestion. This is in my experience how most tools that auto-complete what you're typing work.

What I'm trying to describe is kinda like what set completeopt+=noinsert does for Vim's completion menu.

Is this configurable now or would it be possible to implement as a feature?

mawkler avatar Aug 13 '21 21:08 mawkler

Unfortunately this isn't possible currently.

I'll see if this is implement-able or if I have to change the pipeline architecture to accommodate this.

gelguy avatar Aug 13 '21 21:08 gelguy

Wanted to double-check how set completeopt+=noinsert works: Should tabbing with wilder#next() to next/previous candidates insert text into the command-line? Or is text only inserted after wilder#accept_completion() is called?

gelguy avatar Aug 13 '21 22:08 gelguy

@gelguy Honestly it doesn't really matter to me. Whichever one is easiest to implement I guess? :)

Most auto-completion tools that I've tried in Vim do insert the text after the next alternative is selected (i.e. wilder#next()), so perhaps because of consistency that would be preferred?

mawkler avatar Aug 13 '21 22:08 mawkler

I've added this as part of #68 but it's not documented as I wanted to check if this is the expected behavior.

You can enable it by setting:

call wilder#set_option('noselect', 0)

gelguy avatar Sep 04 '21 14:09 gelguy

I can't speak for melkster, but this does exactly what I wanted.

dusty-phillips avatar Mar 10 '22 14:03 dusty-phillips

@dusty-phillips I have now switched to cmp-cmdline together with nvim-cmp :)

mawkler avatar Mar 11 '22 07:03 mawkler