I'm using web-mode in Emacs to get syntax highlighting and indentation for PHP and HTML.
If I have this code in a .php file
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
And then put the cursor on the middle line and press tab then nothing happens.
I want it to look like this:
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
If I put the text in a tag on a single line and try to indent, it works.
This:
<p>
<a>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
</p>
turns into this, which it should
<p>
<a>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
</p>
My .emacs file
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(setq web-mode-markup-indent-offset 4)
(setq web-mode-css-indent-offset 4)
(setq web-mode-code-indent-offset 4)
(setq web-mode-indent-style 4)
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
. Does indentation fail for you even when you have only the above code in php file? – Wilburnemacs -Q
if it still does not work then maybe this is a bug in web-mode, you should report it on its github repo. – Wilburnhtml
extension but fails for files withphp
extension this is definitely a bug you should report it. – Wilburn