0

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.

2
  • I have a basic configuration and the indentation works. Maybe the problem comes from the line Plugin '2072/PHP-Indenting-for-VIm'. Can you disable it ? Is your test file actually contains php ? Commented Oct 10, 2014 at 14:49
  • after disable the plugin,still not work.and my test file is php file.use :set filetype?,it also says php Commented Oct 10, 2014 at 14:55

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.