Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4d3c51f1aabf526ed6000030

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.

Unlock 188 remaining solutions by signing in and submitting your own entry
#189 luffy / @raxcoi - Score: 141 - 06/12/15 @ 04:14
:%s#</.*>#<CR>:%s/<\zs.*\ze>/%&<CR>u:<Up><Left><Left>\<CR>u:<Up><Left><Left><Left><Left><Left><BS><BS><BS><BS><BS><BS><BS><BS><Left>\v<Right>(.*)<Right><Right><Right><BS><CR>uu<C-R>:<Up><BS>\1<CR>u:<Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Right><Right><BS><BS><CR>:%s/</%<CR>:%s/>/ /<CR>:g/^$/d<CR>:<Up><Left><Left><Left> *<CR>:$<BS>%s/\s*$/<CR>ZZ

0 comments


Created by: @bradly

189 active golfers, 758 entries

Leaderboard (lowest score wins):
65
#181 - Andrew K / @HashDefDeath

01/31/2012 at 02:58AM

69
#182 - mindgitrwx / @mindgitrwx

08/12/2020 at 02:43PM

70
#183 - Reza Lotun / @rlotun

01/30/2011 at 06:36PM

70
#184 - Jakub Okoński / @farnoy

01/25/2012 at 02:12PM

71
#185 - Casey Howard / @caseyhoward

04/08/2011 at 03:38AM

72
#186 - Kornél Lugosi / @Coornail

05/28/2011 at 03:45PM

87
#187 - Kohei Yamamoto / @k_ymmt

01/30/2012 at 01:29PM

132
#188 - Tj / @yrddy

08/19/2014 at 11:34AM

141
#189 - luffy / @raxcoi

06/12/2015 at 04:14AM