4

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

iabbrev hte the " common typo

1 Answer 1

6

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
2
  • Do I have to put the vertical bar | right after the abbreviation?
    – Yossi Gil
    Jan 8, 2016 at 12:27
  • Yes. Try copying the last line of the answer into your Vim command line.
    – mMontu
    Jan 8, 2016 at 12:35

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.