0

For the purpose of this question, imagine that I have set

iab phil philosopher

In vim, as far as I know, the default display pattern when typing out the characters "phil" at the start of the word is to sequentially display each character in the same column until either: 1) I type a character that is not part of the potential abbreviation, 2) I pause long enough the abbreviation will not trigger, or 3) I hit the "end" character and the abbreviation triggers. I find this behavior annoying, especially since I otherwise love abbreviations in vim.

Is there any way to set abbreviations in vim to type, as normal, and then only change text if triggered, rather than holding the character in place until a character is typed that determines if you are using an abbreviation or not? I would be fine with it if the change also affected macros.


Edit: It seems the behavior I am observing is a function of imap/inoremap not iab. I have changed the question to reflect this discrepancy, but leaving the original text in place for context so other *ahem* challenged people will be able to find the appropriate questions.

  • 3
    What you describe only happens when you use imap instead of iab. – Ralf Apr 29 at 16:47
  • Interesting. I only noticed it becoming distracting once I had a lot of abbreviations. Do you know of a way to change the behavior of imap then? – The Pompitous of Love Apr 29 at 17:58
  • 2
    I still think you are confusing things. Please read :help abbreviations and :help key-mapping. Also :help 24.7 and :help 40.1 for a more general explanation of the two concepts. – Ralf Apr 29 at 18:51
  • As Ralf suggests, the simple solution is to use inoreabbrev instead of imap. If you cannot use a simple iabbrev for a particular abbreviation, then there are ways around the redraw issue. – Rich May 1 at 0:12
  • I have revised the question so that @Rich's answers answer the question, for other users. I'll give you a couple of days if you want to post and answer, and I'll credit it to you. If no one else does by the end of the week, I will answer the question. – The Pompitous of Love May 1 at 14:20
0

The behavior described is actually a function of imap (or inoremap) and not iabbrev (= iab). Using abbreviations instead of command mappings will allow you to continuously type, without any pause in place. It bears noting that abbreviations are not necessarily the best option, depending on what you are attempting to do, so use wisely.

Thanks to @Ralf and @Rich for actually providing the answer to this question.

Your Answer

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

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