vimconfigpathogen

Why is properly commented line in vimrc giving error for Missing quote?


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


Solution

  • 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.