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):
27
#31 - Robert Robotter / @robrob12

07/20/2011 at 08:59AM

27
#32 - Junfeng / @junfeng

08/01/2011 at 02:16PM

27
#33 - You-Siang Lin / @yslinnctu

11/30/2011 at 07:37AM

27
#34 - Xavier Nayrac / @lkdjiin

01/08/2012 at 11:23AM

27
#35 - Fitz / @Fitzface

01/17/2012 at 10:59PM

27
#36 - Renat Aksitov / @Korvin79

03/03/2012 at 05:56PM

27
#37 - Trevor Powell / @DoomedBunnies

03/20/2013 at 11:52PM

27
#38 - LC / @leeren

08/11/2014 at 12:00AM

27
#39 - Dimitar Dimitrov / @kurkale6ka

04/13/2016 at 09:35AM

27
#40 - fsj / @FrogzSJ

08/13/2018 at 03:19AM

27
#41 - majo senf / @majo_senf

06/25/2019 at 11:27AM

27
#42 - Miko / @_m_ik_o_

10/12/2019 at 06:37PM

27
#43 - Miłosz Łakomy / @foobar01123

01/28/2020 at 11:45AM

27
#44 - Arya Kumar / @SusSquirrel

05/29/2021 at 04:16PM

27
#45 - russellzhaomao / @russellzhaomao

06/03/2022 at 02:48AM

27
#46 - Qing Liu / @poeminlash

08/04/2022 at 06:17AM

27
#47 - nickGPT / @nickandbro

08/28/2024 at 11:05PM

28
#48 - echarp / @charpmanu

11/10/2011 at 07:42PM

28
#49 - soundscope / @__soundscope__

06/30/2020 at 09:05AM

29
#50 - Pei-Lun Lee / @ypcatw

01/07/2012 at 04:04PM

30
#51 - Johan Sveholm / @rymdtjuren

06/23/2011 at 06:26AM

30
#52 - Justin Love / @wondible

09/05/2011 at 02:51PM

30
#53 - Woojung Kim 김우중 / @_kimwz

07/16/2013 at 01:54AM

30
#54 - Quota / @Quotad

02/13/2014 at 09:32AM

30
#55 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 09:36PM

30
#56 - Mauro Persano / @fzort

11/20/2014 at 01:44PM

30
#57 - Skúli Jóhannsson / @skulibj

06/28/2015 at 09:58PM

30
#58 - churaki / @churaki

01/29/2019 at 10:36AM

31
#59 - h_east (トロッコ6個) / @h_east

01/24/2011 at 01:55PM

31
#60 - Kevin Hamer / @khamer

01/24/2011 at 08:25PM