Is it possible to put vim comments in lines that include iabbrev, as in:

iabbrev hte the " common typo

As explained in :help 40.1 (SPECIAL CHARACTERS):

It is not possible to put a comment directly after a mapping, because the "
character is considered to be part of the mapping.  You can use |", this
starts a new, empty command with a comment.  Example: 

        :map <Space> W|     " Use spacebar to move forward a word

So, you can use | in order to indicate the end of the abbreviation/mapping:

iabbrev hte the| " common typo
  • Do I have to put the vertical bar | right after the abbreviation?
    – Yossi Gil
    Jan 8 '16 at 12:27
  • Yes. Try copying the last line of the answer into your Vim command line.
    – mMontu
    Jan 8 '16 at 12:35

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.