Note.
Note that this problem can also occur if you have the indent on and plugin on file types plugin on separate lines in .vimrc:
filetype indent on filetype plugin on
This results in processing $VIMRUNTIME/indent/php.vim to $VIMRUNTIME/ftplugin/php.vim .
The indent/php.vim resets 'comments' , but ftplugin/php.vim does not work.
The order of the mess:
indent/php.vim get the source code and comments to install correctly:
setlocal comments=s1:,:
Then ftplugin/php.vim get the source. It returns ftplugin/html.vim :
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
which lead to the processing and configuration of ftplugin/html.vim :
setlocal commentstring= setlocal comments=s:
Later in ftplugin/php.vim commentstring there is a reset, but no comments :
setlocal commentstring=
Fix:
filetype indent plugin on " Or filetype plugin indent on " Or with correct order: filetype plugin on filetype indent on
PS.
In any case, the plugin must be processed before indentation.
To check the inclusion / processing order, look at :scriptnames .
user13500
source share