When I edit php file,the autoindent setting just don't work.It works in js css and any other files.Only in php file,I need to turn autoindent on manually.Here's my vimrc.
I found after I run :source ~/.vimrc autoindent is on.I am confused.
1 Answer
The indentation script for PHP files, which is provided by default in vim installation, disables autoindent explicitly. It also defines GetPhpIndent() function, which it uses to do indentation (see indentexpr). That function, in turn, is using b:PHP_default_indenting variable to decide how many shiftwidth will be added to the indentation and by default it is 0.
If you put
let b:PHP_default_indenting = 1
in your .vimrc, the indentation should start working.
Plugin '2072/PHP-Indenting-for-VIm'. Can you disable it ? Is your test file actually contains php ?:set filetype?,it also says php