0

I've been trying to add comments to my vimrc file and for some reason it is not allowing me to comment after the execute pathogen line.

4: execute pathogen#infect()    "Enable Pathogen
5:
6: syntax on      "*Syntax color highlighting*

With vimrc like this, saving and exiting and reentering vim, it gives me an error 'Line 4: Missing quote: "Enable pathogen'

I have syntax highlighting on, and all other comments I make show up as comments, but anything after () on that line doesn't. I don't know if it's something simple I'm missing or if anyone else has seen this, but it seems strange that it's just this one line giving me problems.

I am running Mac OS X 10.13.6 and Vim 8.2.600

0x4a6f7368
  • 38
  • 6

1 Answers1

0

Please, read :h :comment carefully

It is not possible to add a comment to a shell command ":!cmd" or to the ":map" command and a few others (mainly commands that expect expressions) that see the '"' as part of their argument:

...
execute
...
syntax

Also note that if the command does not take "bar" as part of argument (see :h :bar), you still can do

execute pathogen#infect() | "Enable Pathogen

Here you have two commands in a row, and the second one is a pure comment.

However, I suggest always write comments on separate lines and not to mess with this stuff at all.

Matt
  • 13,674
  • 1
  • 18
  • 27
  • 1
    http://vimdoc.sourceforge.net/htmldoc/eval.html#:exe-comment `execute pathogen#infect() | "Enable Pathogen` – phd Apr 29 '20 at 08:20
  • 1
    @phd Yes, but that works, because `execute` (and `syntax`) are in `:h :comment`, but not in `:h :bar`. It won't work, say, for `normal`, as it's in both lists at the same time. – Matt Apr 29 '20 at 08:40