HTML to Haml
Help convert this HTML page to Haml.
Start file
<html>
<head>
<title>Vim Rocks!</title>
</head>
<body>
<h1>So does Haml</h1>
</body>
</html>
End file
%html
%head
%title Vim Rocks!
%body
%h1 So does Haml
View Diff
1,8c1,5 < <html> < <head> < <title>Vim Rocks!</title> < </head> < <body> < <h1>So does Haml</h1> < </body> < </html> --- > %html > %head > %title Vim Rocks! > %body > %h1 So does Haml
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
#102 x aizek / @xaizek - Score: 49 - 02/26/11 @ 03:58
:%s!\s*</.*!!|%s/>$//|%g/^$/d|%s/>/ /|%s/</%/<CR>ZZZ
@abonec: what means bang in substitute?
1 comment
#103 Adam / @djthread - Score: 49 - 04/14/11 @ 09:54
:%s!\s*</.*!!|%s/>$//|%g/^$/d|%s/>/ /|%s/</%/<CR>ZZZ
0 comments
#104 Jonathan Payne / @JonathanPayne4 - Score: 49 - 11/03/11 @ 10:21
:%s?</.*??|%s?<?%?|%s?>$??|%s?>? ?|%g?^\s*$?d<CR><CR>ZZ
0 comments
#105 Jakub Arnold / @JakubArnold - Score: 49 - 12/19/11 @ 08:10
:%s!\s*</.*!!|%s/>$//|%g/^$/d|%s/>/ /|%s/</%/<CR>ZZZ
0 comments
#106 Brandon Ferguson / @bnferguson - Score: 50 - 01/24/11 @ 10:12
:s<BS>%s/\v\<(\w+)\>/%\1 <CR>:%s/<.*/<CR>:v/\w/d<CR>:%s/ $/<CR>ZZ
0 comments
#107 Florian Vallen / @florianvallen - Score: 50 - 02/05/11 @ 12:16
::%s#</.*##|%s/<\(.*\)>/%\1 /|%s/ *$//|%v/\S/d<CR><CR>ZZ
0 comments
#108 Arto Vuori / @dhpe - Score: 51 - 09/01/12 @ 10:17
:%s#</.*#<CR>k2dd:%s#<\([^>]*\)>#%\1<CR>fSi <Esc>4Gdd?V<CR>i <Esc>ZZ
0 comments
#109 Nomen Nescio / @vadtusan - Score: 53 - 04/13/11 @ 04:31
:%s/<\([^/>]\+\)>/%\1<CR>2la <Esc>3l3ki <Esc>:%s/<.\+<CR>ddddkkddZZ
0 comments
#110 Ben Wagaman / @jamin4jc - Score: 53 - 01/12/12 @ 22:23
:%s/<\/\(.*\)//<CR>k2dd:%s/</%/<CR>3lr 2kk3lr :%s/>//<CR>kddZZ
0 comments
#111 Vernon Thommeret / @synotic - Score: 54 - 01/29/11 @ 22:34
r%$xjbbr%$xjbbr%f>r f<d$jddr%$xjbbr%f>r f<d$j2dd:w<CR>:q<CR>
0 comments
#112 Franco Lazzarino / @flazz - Score: 55 - 01/28/11 @ 17:55
:s/>$<Left><Left><Left><Left><Left>%<CR>:<Up><Left><Left><Right>/ <Right><BS><CR>f<D3ggc<f<D:%s/</%/g<CR>4ggdd6ggdGZZ
0 comments
#113 tdirrenb / @tdirrenb - Score: 55 - 05/14/11 @ 10:45
:%s/</%/g<CR>:%s/%\/.*/g<BS>/g<CR>dd.:%s/>/ /g<CR>:4<CR>dd:%s/ $/<CR>:wq<CR>
0 comments
#114 Golf Sinteppadon / @MiniGolf2000 - Score: 55 - 04/25/12 @ 11:16
:%s/</%/g<CR>:%s/>//g<CR>:%s/%\/.*$//g<CR>k02ddfSi <Esc>kkddkfVi <Esc>ZZ
0 comments
#115 Matthieu Honel / @ocus - Score: 56 - 01/26/11 @ 13:00
:%s/\v\<(\w+)\>/%\1 <CR>:%s/\v\<\/\w+\>/<CR>ddddkkdd:%s/ $/<CR>ZZ
0 comments
#116 abonec / @abonec - Score: 56 - 04/30/12 @ 04:19
/<\/.*<CR>g&:g/^\s*$/d<CR>:%s/</%/g<CR>:%<BS>s<BS>%s/>$//g<CR>:%s/>/ /g<CR>ZZ
0 comments
#117 JR Boyens / @jboyens - Score: 57 - 01/24/11 @ 10:56
:%s#</.*##|%s#<\(.*\)>#%\1 #|%s/\s*$//|%s/^\s*\n//g<CR>dddZZ
0 comments
#118 Tallak Tveide / @tallakt - Score: 57 - 10/18/12 @ 07:20
:%s#</.*##|%s#<\(.*\)>#%\1 #|%s/\s*$//|%s/^\s*\n//g<CR><CR>ddZZ
0 comments
#119 Jon Allured / @jonallured - Score: 58 - 09/13/11 @ 18:09
:%s/</%/<CR>:%s/>//<CR>ddddlla <Esc>wwwwd$kkddklllllllli <Esc>wwwld$:wq<CR>
0 comments
#120 Dmitry Teslenko / @krab_mozga - Score: 62 - 01/25/11 @ 01:43
:%s/<\(\w*\)>/%\1 /<CR>:<Up><BS><BS><BS><BS><BS><Left><Left><Left><Left><Left><Left><Left><Left><Left>\/<CR>2dddddd2kdd$x2k$xkx:wq<CR>
0 comments
#121 CJP / @Cam_Peterson - Score: 64 - 03/29/11 @ 17:53
r%^^$<BS><Right>dxxer%eexer%eer eee<Left>veeexeddr%$<Del>er%eer eee<Right>v$<Del>i<CR><Esc>dddd:wq<CR>
0 comments
#122 Andrew K / @HashDefDeath - Score: 65 - 01/30/12 @ 18:58
:0,$s/<\/.*//g<CR>:0,$s/<\(.*\)>/%\1 <CR>:4d<CR>:6,7d<CR>:4$x<CR>:4<CR>$x:2<CR>$x<Up>x:x<CR>
0 comments
#123 Reza Lotun / @rlotun - Score: 70 - 01/30/11 @ 10:36
:1,$s/</%/g<BS><CR><Esc>:1,$s/<\/.*//<CR><Esc>:1,$s/>//g<CR>dddd/S<CR>i <Esc><Esc>kkddkwwwhhhhi <Esc>:wq<CR>
0 comments
#124 Jakub Okoński / @farnoy - Score: 70 - 01/25/12 @ 06:12
/<BS>::<BS>%s/<\/\w*>//g<CR>ddddkkdd/<BS>:%s/</\%/g<CR>qw/><CR>cl <Esc>qkkq<Esc><Esc>@w:%s/>//g<CR>:wq<CR>
0 comments
#125 Casey Howard / @caseyhoward - Score: 71 - 04/07/11 @ 20:38
:%s/[<>\/]//g<CR>9ki%<Right><Down>%<Right><Down>%<Esc>ww<Left><Left><Left><Left>i <Esc>ww6l<Esc>8x<Esc>jddi%<Down><Right>%<Right><Right> <Esc>9l4l<Esc>xx<Esc>j<Esc>2dd<Esc>:x<CR>
0 comments
#126 Kornél Lugosi / @Coornail - Score: 72 - 05/28/11 @ 08:45
:%s/</%/g|s<BS>%s/>//g<CR><CR><Up><Up><Up><Up><Up>www<Left><Left><Left><Left><Left>a <Esc><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>C<Esc><Down>dd<Down><Right><Right><Right><Right>a <Esc>3wwC<Esc><Down>V<Down>dZZ
0 comments
VimGolf