obsidian-various-complements-plugin
obsidian-various-complements-plugin copied to clipboard
Feature Request: Two-Step Completions
The Problem
After accumulating more words in my custom dictionaries, I noticed a lot of completions actually share a similar "string beginning". For example I have quite a bunch of completions that look like this:

The problem here is that I would have to scroll through quite the list if I wanted to select "innovation studies". Narrowing down the list by typing more letters also is quite inefficient, since I would have to type out "innovation s" reduce the number of completions sufficiently. However, both methods would defeat the purpose of an autocompletion mechanism, since the very idea of of autocompletion is to reduce the amount of typing.
I think the problem is specific to autocompletion of natural languages, since conjugations or plural forms result in words with a similar stem ("organize", "organizing", "organization", ...)
A Suggestion for a Solution I think the best solution to tackle this would be some sort of "two-step-completion". If Various Complements notices that there are many items that have the same beginning, then it should (partially) merge the items into a new item that is consists of the shared string beginning. Selecting that item would complement that partial string, and instantly trigger a second, follow-up suggester, displaying the remaining string of the previously merged items. Let me illustrate with an example. Suppose you have a custom dictionary with the following terms:
- organize
- orchestra
- organizing
- organizers
- organizer
- organization
- organizations
Typing "or" would give you seven suggestions, a lot to scroll through if you want to select "organizations". But as six of the items share a string beginning – "organiz" – the suggester could summarize and display two items:
- organiz...
- orchestra
Now, if I select "orchestra", various complements would work as usual. However, if I select "organiz...", Various complements would complement "organiz" and then display a follow-up suggester, displaying these items, which are the "remaining" strings of the items from above, if you cut "organiz".
- e
- ing
- ers
- er
- ation
- ations
Now, I could type "a" to reduce the list to two items, and then easily select one of them.
Evaluation of the Suggested Solution Now we can compare the different approaches to see how the suggestion would improve the autocompletion mechanism. Suppose we want to select "organizations" from our list of seven items from above.
- Method 1: type
or, hitarrow downsix times, hitenter→ 9 keystrokes - Method 2: typing till you have reduced the list to two items:
organiza, then hitarrow downone time, hitenter→ 10 keystrokes - Method 3 (the suggested solution): type
or, hitenterto select "organiz...", typea. You now have "ation" and "ations" left, and pressarrow downandenterto select right word. → 5 keystrokes
That's a reduction of keystrokes by ~50%. And that does not even factor in the fact that the suggested solution also reduces the amount of text your eyes see (the redundant "organiz" is only displayed once, not six times), which probably also makes the "scanning" for the right item quicker. And on top of that, this is even a fairly simple example. In cases like with the screenshot above (all the words starting with "innovat"), the words are longer and there are more items; meaning you would save even more keystrokes in cases like that.
Implementing this feature request would make Various Complements reflect the characteristics of natural languages, instead of simply applying the autocompletion-logic from code editors without considering that text is different from code. This would make Various complements a truly smart completion engine – one that I even do not know in any other app.
Hi, @chrisgrieser. Thank you for your FR :)
Your suggestion is very amazing, but it would be too hard to implement it for now.
As an alternative, how about a terminal-like feature that completes up to common forward matching characters?
For example.
- organize
- orchestra
- organizing
- organizers
- organizer
- organization
- organizations
If we push org<TAB> , it completes to organiz and shows suggestions as follows.
- organize
- organizing
- organizers
- organizer
- organization
- organizations
In addition, the following issue may also help.
https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/issues/141
As an alternative, how about a terminal-like feature that completes up to common forward matching characters?
that sounds like a very good alternative solution, yes! Potentially even better than mine, cause users familiar with the Terminal (to which I also belong) may find this more intuitive
@chrisgrieser I have released v7.4.0-beta1 🚀
Please enable the following option and try it 👍

I have been using this feature for a while and personally I am not sure if it is really necessary. So I marked this feature as Experimental.
Thanks, I just tried it and works so far. I'll keep you posted how well it works on daily usage.
One thing I already noticed is that it kinda interferes with tab as additional cycle key, and tab-cycling is the standard in the Terminal or in code editors, so it might be useful to have alternatives keys for common prefix completion. But I'm also not sure about this one 🤔
Thank you for your trying :)
it might be useful to have alternatives keys for common prefix completion
I agree 👍
Hi,
I'm a bit late to the discussion, but how about something like this:
Where you can press the corresponding number to select the word you need. The screenshot is from Fastkeys, which also has autosuggest, but the problem with it is it doesn't show the suggestions under the caret and doesn't have all the other goodies Various Complements has.
@Drakemoor Please follow the https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/issues/141 👍
After #245
@chrisgrieser I have released it in v9.0.0-beta1 🚀
I would appreciate it if you could check it out before the official release.
I currently can't discern the hotkey "completion" with simply pressing Esc
@vanbang9710 I do not recommend assigning Escape, but if necessary, create an Issue.
I meant I don't know what the hotkey "completion" is for. It seems the same as Esc
@vanbang9710 Please read this issue.
I've already read it before asking. Can you please explain further?
I meant I don't know what the hotkey "completion" is for. It seems the same as Esc
The "completion" command runs "Two-Step Completions".
chrisgrieser already explains why such a completion is needed as https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/issues/156#issue-1316022345. Then, I implemented that feature link https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/issues/156#issuecomment-1200340717.
If you are unclear about any of those comments, please quote them and ask questions.
When I press "Completion", the models is closed and the word stays the same 
@vanbang9710
the word stays the same
It is as expected because all suggestions start with machine. For details, please read https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/issues/156#issuecomment-1200340717.
the models is closed
It is not as expected. And I couldn't reproduce it. Could you tell me the reproduction steps in the sandbox vault?
I understand how it works now. Sorry, the unexpected behavior was because I used an assigned hotkey
@tadashi-aikawa Thank you for the wonderful plugin and apology for adding a comment on a closed ticket. Want to add here to keep the context. My question is:
I tried tab-based completion (like in the terminal), but the tab key works differently in obsidian. How do I utilize this feature? Thanks!
Thank you @tadashi-aikawa. Appreciate the quick response!