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

205 active golfers, 881 entries

Leaderboard (lowest score wins):
41
#121 - Jouko Karvonen / @joukokar

02/03/2011 at 05:24AM

41
#122 - じょんあば / @john_ababa

05/26/2012 at 02:49AM

41
#123 - J. Nick Terry / @deft_code

08/28/2012 at 06:17PM

41
#124 - Bill Booth / @ohiopyle

01/29/2014 at 07:42AM

41
#125 - Ivo Blöchliger / @aigledesalpes

08/23/2019 at 09:14PM

41
#126 - Steffen / @Pions90

02/16/2020 at 11:02AM

42
#127 - Bradly Feeley / @bradly

01/23/2011 at 06:03PM

42
#128 - Michał Taszycki / @mehowte

01/24/2011 at 10:28AM

42
#129 - Esa-Matti Suuronen / @EsaMatti

04/25/2011 at 10:16AM

42
#130 - nona urbiz / @nospampleasemam

09/29/2013 at 09:07AM

42
#131 - david ta / @tadavid

11/20/2013 at 11:27PM

42
#132 - Daniel / @Daniel00288663

04/03/2017 at 07:37AM

42
#133 - Chester Yap / @Chest_ErYap

08/03/2019 at 08:23PM

43
#134 - Thomas Schönwälder / @Masei1988

01/23/2011 at 05:07PM

43
#135 - Francois Marais / @maraisf

04/05/2018 at 07:13PM

44
#136 - Joost / @vlabakje

02/12/2011 at 04:01PM

44
#137 - Sid Kasivajhula / @CountVajhula

02/17/2011 at 08:29AM

44
#138 - Dave / @zzdave13

07/21/2011 at 09:02PM

44
#139 - Brian / @wyantb_reader

06/26/2014 at 02:23AM

44
#140 - Scott Atkins / @scottrick49

07/06/2021 at 12:39PM

45
#141 - James Cash / @jamesnvc

05/02/2011 at 02:50PM

45
#142 - Daniel / @dbb0

02/20/2012 at 09:29PM

45
#143 - Yariv / @yarivb

09/07/2014 at 02:07PM

45
#144 - ltn614 / @ltn614

09/24/2015 at 07:38AM

45
#145 - Ryan Marcotte / @ryanjmarcotte

11/24/2016 at 11:34PM

45
#146 - shahanavaz m / @shahanavazm

02/20/2022 at 02:23AM

45
#147 - Frédéric Heulin / @talineo

12/08/2023 at 03:58PM

46
#148 - Josh Kenzer / @jkenzer

02/12/2011 at 03:31AM

46
#149 - Joel Taylor / @joelteon_

03/28/2011 at 03:24PM

46
#150 - Christopher Brew / @Seph1rothVII

01/11/2012 at 06:45PM