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

204 active golfers, 878 entries

Leaderboard (lowest score wins):
23
#1 - Tim Chase / @gumnos

06/03/2012 at 12:29AM

23
#2 - Kerson Hsiao / @KersonHsiao

08/07/2012 at 03:44PM

23
#3 - Urtica dioica / @udioica

12/11/2012 at 01:32AM

23
#4 - Petro Тrouq / @zulolosi

06/04/2013 at 08:22PM

23
#5 - Bradd Szonye / @bszonye

07/15/2013 at 02:52AM

23
#6 - John Braxler / @braxler

04/21/2014 at 02:42PM

23
#7 - kimber gonzalez / @kimberlycreates

01/22/2015 at 03:25PM

23
#8 - Jon Krause / @jkrause314

01/26/2016 at 06:04PM

23
#9 - alekfed / @alek_fed

04/20/2019 at 08:33AM

23
#10 - Peppa Pig / @PeppaPi95550250

06/02/2024 at 07:23AM

24
#11 - Saki Gw / @Sakigw

02/05/2017 at 07:19PM

24
#12 - sijinyuan / @sijinyuan

03/23/2017 at 01:33AM

24
#13 - Turkey Man / @lvturkeyman

11/25/2017 at 08:18AM

24
#14 - DHM / @DHM29978992

04/30/2018 at 07:11PM

24
#15 - Mihai / @mihaicristiant

01/29/2019 at 08:38AM

24
#16 - Lory / @Lory46845742

12/03/2019 at 01:50PM

24
#17 - Jean George / @JeanGeo20504212

03/13/2022 at 09:04PM

24
#18 - 刘宏亮 / @AkeyCoy

09/25/2022 at 03:56AM

26
#19 - jimauthors / @jimauthors

02/14/2014 at 01:17AM

27
#20 - Federico Galassi / @federicogalassi

01/25/2011 at 10:04PM

27
#21 - Steve Morrow / @yawmark

01/26/2011 at 02:35AM

27
#22 - Wei Dai / @clvv42

01/28/2011 at 06:29AM

27
#23 - Ujjwol Lamichhane / @Ujjwol

02/03/2011 at 03:01AM

27
#24 - Andrew Dorman / @andydorman

02/16/2011 at 04:37PM

27
#25 - bluewookie / @bluewookie

02/21/2011 at 11:36PM

27
#26 - vg / @vimgolfer

03/04/2011 at 02:19PM

27
#27 - Wesley Beary / @geemus

04/05/2011 at 01:05AM

27
#28 - Dragan Cvetinovic / @kawkafi

05/10/2011 at 10:29PM

27
#29 - Emile Swarts / @EmileSwarts

06/09/2011 at 07:59PM

27
#30 - not so punk :] / @notsopunk

06/19/2011 at 06:54AM