0

Standard Vim completion supposes that you type in the beginning of the word, then press CTRL-N, and get all the words that begin with the prefix you typed in.

In my situation, prefixes are mostly the same, and I don't quite remember them, but I know exactly what's "inside" the word I want to complete.

E.g.: 3 prefixes, 0_, 1_, 2_, and about 100 of keywords built on top of them (e.g. 0_keys, 0_car, 1_weekend, 1_store, 2_weather, 2_elephant).

I want to be able to use some way to complete the word without typing in the prefix. E.g. use some hot key, or sequence of hotkeys, type in "elep", then maybe some more hotkeys, and have it expand to "2_elephant".

Notes:

  • I don't really need "true fuzzy" completion, as in CtrlP, when you can use any sequence of letters -- it's enough to work on a substring (as in InteliSense).
  • I'm fluent with vimscript, so if there's an API that allows to implement custom completion in input mode -- please let me know how to access it!
  • If there are functions in CtrlP that could help here with some extra scripting -- please point me to them.
  • Abbreviations (:abbr) does not work because list of these words is dynamic, maintaining them as a separate .vim file with list of abbr commands does not make much sense.
  • There might just as well be an obvious solution, like a well-known plug-in, I just don't know that much about plugins developed last 5-10 years.

Thanks in advance. Any help is much appreciated.

  • More recent plugins such as deoplete are capable of fast fuzzy matching over completion sources. It depends how the source gathers matches though - most begin on prefixes, so that won't help you. I've had good experiences with building custom deoplete sources in python. Could be worth a look. – swalladge Feb 2 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.