Thanks to #18329 we have consistently selected no items resulted from autocomplete. I'm not sure if it's correct without noselect
so ask here.
If so, is it possible to get the first menu item selected (as if <C-n>
was pressed then)?
The below example is almost copied from #18326:
Let file /tmp/words
consist of
v
vi
vim
vim --clean -c 'se ac completeopt=menuone,noinsert,fuzzy' -c 'normal G' -c 'startinsert' /tmp/words
v
(no item selected)Expected result:
image.png (view on web)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
It’s not entirely clear what you want. Are you asking to have the first item inserted automatically? That isn’t possible, since <BS>
wouldn’t work in that case. However, you can enable preinsert
, which will select the first item for you. This option doesn’t work as expected yet, but I plan to implement it soon.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I would be interested with preinsert
, but it does not work with fuzzy
.
Currently we need to press <C-n>
to get the first menu item active. I'd like to have it done automatically (and then get CompleteChanged
event too).
It seems that we have no autocommand notifying when the menu is displayed.
The simple autocommand
au ModeChanged *:ic call feedkeys("\<C-n>")
seems to be not useful:
<C-n>
may be entered too early, i.e. while acl
is still pending<C-n>
I'm not sure if autoinserting <C-n>
enough late would give me any useful result, but wanted to see what fails in such case.
Writing this comment I played with:
set autocomplete set autocompletedelay=300 set completeopt=menuone,noinsert,fuzzy set cpt+=k/usr/share/dict/american-english au ModeChanged *:ic call feedkeys("\<C-n>") startinsert
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Forgive me for still being a bit confused about completeopt
. If is true that autocomplete
implicitly enables noselect
(especially after making consistence in #18329), then maybe it is worth documentation.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
autocomplete
automatically applies noselect
unless you include preinsert
.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
If I've missed something, it would be worth documenting.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
It is documented in :h cot
in maybe not a clear way:
Only "fuzzy", "popup", "popuphidden", "preinsert" and "preview" have
an effect when 'autocomplete' is enabled.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
There is no noselect
😉 Even if it were there, it would sound like an option that depends on being enabled manually, whereas, as you mentioned, currently it is forced by autocomplete
(except with preinsert
).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Can you write a draft of enhanced help document? I think you have a point. I can review it and include it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 748b5ae0..4b96f20b 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2293,7 +2293,8 @@ A jump table for the options with a short description can be found at |Q_op|. noselect Same as "noinsert", except that no menu item is pre-selected. If both "noinsert" and "noselect" are - present, "noselect" has precedence. + present, "noselect" has precedence. Forced when + "preinsert" is not present, but 'autocomplete' is active. nosort Disable sorting of completion candidates based on fuzzy scores when "fuzzy" is enabled. Candidates will appear
What do you think?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.