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 196 remaining solutions by signing in and submitting your own entry
#197 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

197 active golfers, 800 entries

Leaderboard (lowest score wins):
56
#181 - Matthieu Honel / @ocus

01/26/2011 at 09:00PM

56
#182 - abonec / @abonec

04/30/2012 at 11:19AM

57
#183 - JR Boyens / @jboyens

01/24/2011 at 06:56PM

57
#184 - Tallak Tveide / @tallakt

10/18/2012 at 02:20PM

58
#185 - Jon Allured / @jonallured

09/14/2011 at 01:09AM

62
#186 - Dmitry Teslenko / @krab_mozga

01/25/2011 at 09:43AM

64
#187 - Cam Peterson / @Cam_Peterson

03/30/2011 at 12:53AM

64
#188 - Kitsan / @Strustle

12/01/2020 at 09:32PM

65
#189 - Andrew K / @HashDefDeath

01/31/2012 at 02:58AM

69
#190 - mindgitrwx / @mindgitrwx

08/12/2020 at 02:43PM

70
#191 - Reza Lotun / @rlotun

01/30/2011 at 06:36PM

70
#192 - Jakub Okoński / @farnoy

01/25/2012 at 02:12PM

71
#193 - Casey Howard / @caseyhoward

04/08/2011 at 03:38AM

72
#194 - Kornél Lugosi / @Coornail

05/28/2011 at 03:45PM

87
#195 - Kohei Yamamoto / @k_ymmt

01/30/2012 at 01:29PM

132
#196 - Tj / @yrddy

08/19/2014 at 11:34AM

141
#197 - luffy / @raxcoi

06/12/2015 at 04:14AM