I’ve just implemented what I call (out of ignorance for the correct term) “word-mode” matching in Complete::Util 0.39. You can see the result in all Perinci::CmdLine-based CLI scripts, for example lcpan.

If you are an Emacs user, you’ll know what I mean. When completing for function names (M-x) or file names (C-x C-f) you can complete by using a word that does not need to be right after the cursor position: it can be one or several words after that. For example, if you want to complete “color-theme-dark-laptop”, it’s pretty annoying to complete using normal method because you need to type at least “color-theme-dark-l” to get a unique completion, or “colo[tab]da[tab]l”. Alternatively, you can just type “c-lap” and immediately get a unique completion. This is because Emacs will try to find any string which has the word that begins with “c” followed by a word that begins with “lap”. The words do not need to be adjacent to each other. (Actually, Emacs can also immediately complete if you use “-lap”.)

So the convenience being offered is, you can complete a string that has several/many words using just the beginning of the words that you remember or words that will more likely result in a unique completion. As long as you know that the words are in there and in the correct order, they don’t have to be right next to one another.

Let’s see this in action. lcpan has a lot of subcommands. To complete the “mods-from-same-dist” subcommand, you can now just type “m-sa”.

% lcpan m-sa[tab] % lcpan mods-from-same-dist _