I want to create abbreviation for a large word, say configuration.

Vim command works even if we type part of it. Example, s[ubstitute].

When you type s, su, sub, subs, subst, substi, substit, etc., all these keywords work for the same command substitute.

Likewise, When I type Conf or Confi or Config or Configu, ... It has to expand to the full word. The user has to decide what should be the minimum part. In this case, it is Conf.

Without writing function or multiple remappings, is there a way to make this work?

I tried this way

:abbr conf[iguration] configuration

But it didn't work.

  • I tried this in all different modes like abbr, iabbr, imap, inoremap also. Didn't work.
    – SibiCoder
    Apr 19, 2016 at 12:25
  • 2
    I don't understand your problem: if you use :iabbrev conf configuration the full word will appear when you write conf so you fixed the minimum letters to write to trigger the abbreviation, right?
    – statox
    Apr 19, 2016 at 12:42
  • 1
    That's right. In case if I happen to type confi (an additional lettler, without typing a space and typing the next letter), still it has to expand. That's what I want. Since we have to deal with hundreds of words while typing, it might be difficult to type exact short part every time.
    – SibiCoder
    Apr 19, 2016 at 13:34
  • 4
    You should use dictionary completion. Abbreviations and mappings don't fit your use case.
    – romainl
    Apr 19, 2016 at 15:59

2 Answers 2


If you really want to use abbreviations, I'm afraid you'll have to

  • either define one abbreviation for each leading part.
  • or to define a mapping on a trigger like <tab> (or whatever) that analyses what is before the cursor in order to expand the missing part. In the end, this is how snippets plugins are expanded (except they are much more advanced)

You can also define a dictionary file and use it to explicitly complete text on i_CTRL-X_CTRL-K (-> :h 'dictionary')


Here is a little function that may help you, because I don't think you can do otherwise:

function! s:ExpandAbbrev(word, start)

  let l:start = a:start

  while l:start < len(a:word)
    let l:tmp_abb = strpart(a:word, 0, l:start)
    let l:start += 1

    execute 'iabbrev '.l:tmp_abb.' '.a:word


You pass the string you want abbreviations for and the minimal length to be expanded.


call <SID>ExpandAbbrev('Configuration', 3)

Will produce (result of :iabbre):

i  Configuratio  Configuration
i  Configurati   Configuration
i  Configurat    Configuration
i  Configura     Configuration
i  Configur      Configuration
i  Configu       Configuration
i  Config        Configuration
i  Confi         Configuration
i  Conf          Configuration
i  Con           Configuration 
  • Please expand your answer. Will this function be automatically called when I type a word?
    – SibiCoder
    May 11, 2016 at 15:27
  • No, this function will create abbreviations. cf the execute 'iabbrev ...'
    – nobe4
    May 11, 2016 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.