You can probably do it without plugin :)
Test this
:s/<[^>]*>/\r&\r/g
to split lines then remove spaces with
:g/^$/d
finally
gg=G
Hope it works :)
문제
I have an HTML file that doesn't have any line breaks. Practically a huge portion of it is in a single line. I was trying to tidy that in Vim; I tried gg=G
, which just tried to intend the first four lines that were on separate lines.
I tried that after the following commands:
:filetype indent on
:set filetype=html
:set smartindent
note:
해결책
You can probably do it without plugin :)
Test this
:s/<[^>]*>/\r&\r/g
to split lines then remove spaces with
:g/^$/d
finally
gg=G
Hope it works :)
다른 팁
For reformatting and clean up of HTML, I usually pipe this through Tidy or html-beautify.js:
:%! tidy --indent yes --wrap 0 --tidy-mark no --force-output true -quiet --show-errors 0 --show-warnings 0
:%! html-beautify.js --file -