8

I edit PHP in Vim and have enjoyed the auto-indenting, but PHP's alternative syntax doesn't auto-indent how I would like. For instance, in an HTML template, Vim doesn't recognize the open control structure in the same way it does when using braces. Example:

<html>
  <body>
    <p>
      <?php if (1==1): ?>
      This line should be indented.
      <?php endif; ?>
    </p>
  </body>
</html>

I want Vim to recognize the open control structure and indent the HTML within it. Another example which uses pure PHP:

<?php
  if (1==1):
    echo "This line gets indented";
  echo "This one doesn't";
  endif;
?>

The indentation is terminated by the semicolon, even though the control structure is still open.

Does anybody know how to get Vim to work in these situations? Thanks.

1 Answer 1

1

It would seem that this is not possible given the currently available Vim plugins, nor is it likely to be addressed.

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.