4

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

iabbrev hte the " common typo
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 '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

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .