Monday, February 21, 2011

Incorrect comments set for php in vim

My vim used to auto-continue comments in php. For example:

/* |  <- cursor here

Then, pressing Enter gives me:

/*
 * |  <- cursor here

and again, gives me:

/*
 *
 * |  <- cursor here

etc...

As far as I understand it, this is controlled by the comments and formatoptions options. However, whenever I open a php file now, comments is set to:

s:<!--,m: ,e:-->

I've looked all over my ~/.vim folder, as well as the $VIMRUNTIME folder, and I can't find out where/why this changed, and why the comments option is being set incorrectly.

Here's a link to my .vimrc

http://pastebin.com/f1509ce65

From stackoverflow
  • The php.vim file should be in your ftplugin folder in $VIMRUNTIME.

    In version 7.2 of vim, the comments line is line 74 in that file.

    Did that file get deleted or moved?

    Bryan Ross : No, it's still there. Maintainer: Dan Sharp URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
    John Weldon : do you have any files in your personal .vim/ftplugin that could be overriding the comments? Or your .vim/filetype.vim for that matter?
    Bryan Ross : Found it. see answer
  • Found it. I had a funky .vim/indent/php.vim file that somehow was screwing it up.

    Deleted it, and the functionality I was looking for returned. Thanks tho!

0 comments:

Post a Comment