0

I've got a lot of HTML files, some of them with garbage indentation.

How can I select a block, and then prettify/reindent the HTML within, adding in newlines where appropriate? I can install any plugin necessary.

1

Read :h 'equalprg'—you can set this to, e.g., prettify for html filetypes by placing a setlocal in ~/.vim/after/ftplugin/html.vim.

Then, use the = operator over a motion, text object, or Visual selection to prettyify that code.

  • Would this solve the problem with php+html indentation problems? – klaus Mar 8 at 14:27
  • @klaus I have no idea – D. Ben Knoble Mar 8 at 14:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.