I have been a Vim user for several years now and I haven't been able to find a solution to this issue. There have been a lot of questions on the internet that try to address it, but none of the solutions I found work properly. When I'm doing WordPress development I need to mix in HTML into my template files. What I ideally want is for Vim Closetag to function in PHP files the same way it does in HTML files.

What I get is this:

Type: <table>> Returns:


This gets even more annoying when dealing with inserting these tags in an already indented line.

What I want is:


I have tried these settings with no luck.

let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.php'
let g:closetag_filetypes = 'html,xhtml,phtml,php'

A "solution" I found is setting ft to either phtml or html, but that then stops ALE's linting and fixing.

Does anyone have a viable solution for this? It's been driving me absolutely nuts and I can't figure out a good solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.