Real Vim ninjas count every keystroke - do you?

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

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

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 500855e60599d90002000073

Convert pandoc unordered list to a numbered list

I know it's possible to use #. in pandoc to auto-generate numbered lists, but then it's not easy to tell how many items there are when reading it in Markdown. How fast can you make the switch?

Start file
My cursor happens to be on this line

## Here is my unordered list
   * item 1
      + it has some sub-items
         - sometimes it has sub-sub-items
      - i list some information about it
   * here is another item
   * and another
      - with some random sub-item
      - maybe with something in **bold** to make asterisks suck
   * woohoo I'm listing stuff like mad
   * I'm a mad pandoc'ing fool
      - long-live **John MacFarlane**!
      + reasons why pandoc is awesome
         - there's just too many list
         - but i'll put some more sub-sub-items for example
         - superfluous - and + to make matching them a pain
   * woo look at these sexy bullet points
   * you almost don't want to turn them into integers
   * but then you do because you know it's the right thing to do

## Here's some other stuff in the file
   * blah blah blah
   * maybe I should go with #. but then it's not readable in txt format
End file
My cursor happens to be on this line

## Here is my unordered list
   1. item 1
      + it has some sub-items
         - sometimes it has sub-sub-items
      - i list some information about it
   2. here is another item
   3. and another
      - with some random sub-item
      - maybe with something in **bold** to make asterisks suck
   4. woohoo I'm listing stuff like mad
   5. I'm a mad pandoc'ing fool
      - long-live **John MacFarlane**!
      + reasons why pandoc is awesome
         - there's just too many list
         - but i'll put some more sub-sub-items for example
         - superfluous - and + to make matching them a pain
   6. woo look at these sexy bullet points
   7. you almost don't want to turn them into integers
   8. but then you do because you know it's the right thing to do

## Here's some other stuff in the file
   * blah blah blah
   * maybe I should go with #. but then it's not readable in txt format

View Diff

4c4
<    * item 1
---
>    1. item 1
8,9c8,9
<    * here is another item
<    * and another
---
>    2. here is another item
>    3. and another
12,13c12,13
<    * woohoo I'm listing stuff like mad
<    * I'm a mad pandoc'ing fool
---
>    4. woohoo I'm listing stuff like mad
>    5. I'm a mad pandoc'ing fool
19,21c19,21
<    * woo look at these sexy bullet points
<    * you almost don't want to turn them into integers
<    * but then you do because you know it's the right thing to do
---
>    6. woo look at these sexy bullet points
>    7. you almost don't want to turn them into integers
>    8. but then you do because you know it's the right thing to do

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 30 remaining solutions by signing in and submitting your own entry
#31 Arto Vuori / @dhpe - Score: 42 - 08/31/12 @ 11:42
/*<CR>r1a.<Esc>ylnr2pnr3p5nr4pnr5p5nr6pnr7pnr8pZZ

0 comments

#32 Yann Moisan / @YannMoisan - Score: 43 - 01/12/13 @ 09:11
:4,21s/ \* / 1. <CR>/1.<CR>n<C-A>n<C-A><C-A>n3<C-A>n4<C-A>n5<C-A>n6<C-A>n7<C-A>ZZ

0 comments

#33 J Paul Daigle / @jpauldaigle - Score: 46 - 07/23/12 @ 08:02
3+s1.<Esc>3++.h<C-A>j.s3.<Esc>4+.hk.h<C-A>j..6+s6.<Esc>+.h<C-A>js8.<Esc>ZZ

0 comments

#34 Слава / @slava_and_ipad - Score: 46 - 08/08/12 @ 04:17
/* <CR>s1.<Esc>ns2.<Esc>ns3.<Esc>nns4.<Esc>ns5.<Esc>ns6.<Esc>ns7.<Esc>ns8.<Esc>ZZ

0 comments

#35 Paul Anton Letnes / @Dynetrekk - Score: 50 - 08/21/12 @ 00:20
/ \* /b1<CR>s1.<Esc>ns2.<Esc>ns3.<Esc>ns4.<Esc>ns5.<Esc>ns6.<Esc>ns7.<Esc>ns8.<Esc>ZZ

0 comments

#36 Thijs Brobbel / @tiesmaster - Score: 51 - 07/30/12 @ 02:13
/^\s*\*/e<CR>s1.<Esc>ns2.<Esc>ns3.<Esc>ns4.<Esc>ns5.<Esc>ns6.<Esc>ns7.<Esc>ns8.<Esc>ZZ

0 comments

#37 Ravi S Sinha / @ambidextrousTx - Score: 51 - 09/09/12 @ 14:34
:let a=1<CR>qa/*<CR>cw<C-R>=a<CR>.<Esc>:let a+=1<CR>q2@a4n2@@4n3@@<Esc>:wq<CR>

0 comments

#38 RusAlex Pletnev / @RusAlexander - Score: 69 - 07/25/12 @ 12:03
/* <CR>r1yawqqnvp<C-A><Esc>ur2nr3nnr4uuuur1nr2nr3nr<Esc><Esc>nr4nr5nr6nr7nr8:%s/\d/&.<CR>ZZ

0 comments

Created by: @connermcd

38 active golfers, 108 entries

Leaderboard (lowest score wins):
Q6hrg93p4r3hn56thmd0_normal
22
#1 - Urtica dioica / @udioica

07/19/2012 at 06:08PM

Astro_seek_normal
22
#2 - Sebastian Kusnier / @skusnier

07/22/2012 at 09:38AM

Media_fast_forward_normal
22
#3 - Frank Twitting / @knarfben

07/23/2012 at 06:56AM

5yoeuh28_normal
22
#4 - Dr. Funkenstein / @_weslly

07/23/2012 at 08:00AM

Default_profile_3_normal
22
#5 - James Davis / @tripvg

08/13/2012 at 09:07PM

40051_789281885907_29616532_44170636_2091417_n_normal
23
#6 - Conner McDaniel / @connermcd

07/19/2012 at 08:40PM

Ewbdmdtg_normal
23
#7 - Tim Chase / @gumnos

07/20/2012 at 06:27AM

4654945923_eb2c60ee5f_normal
24
#8 - Kerson Hsiao / @KersonHsiao

07/20/2012 at 02:20AM

Jlove201003sq_normal
24
#9 - Justin Love / @wondible

07/20/2012 at 06:34AM

Default_profile_1_normal
24
#10 - q_revert / @q_revert

07/20/2012 at 07:21AM

Image_normal
24
#11 - Raúl Jara / @rauljara

07/20/2012 at 09:42AM

Rti70_normal
24
#12 - Peter Anselmo / @peter_anselmo

07/28/2012 at 08:25AM

312189_10150481221796258_700041257_11172966_434509532_n_normal
24
#13 - Sean Griffin / @sgrif

08/12/2012 at 04:25PM

Fireshot_pro_capture__014_-__google______1000____-_www_google_com_reader_view__stream_feed_2fhttp_3a_2f_2ffeed_feedsky_com_2fmedowo_normal
24
#14 - 刘玮 / @lwjef

08/16/2012 at 05:30PM

Mobile_photo_mar_15__2010_12_39_49_normal
24
#15 - Rod Knowlton / @codelahoma

08/17/2012 at 02:13PM

Default_profile_3_normal
24
#16 - Édouard M'tou / @DouardM

10/09/2012 at 12:59AM

Dsc_0096_2_normal
24
#17 - Victor Ramirez / @virako

10/17/2012 at 06:08PM

Hnc_normal
25
#18 - Sebastian Korten / @FlashKorten

07/20/2012 at 12:06AM

12e3ab10a91992d5eed681da5d171823_normal
25
#19 - Steve Tjoa / @stevetjoa

08/09/2013 at 02:40PM

Default_profile_6_normal
25
#20 - jolka / @jolka19296078

05/23/2014 at 04:50PM

Netti_pihlajo1_lthumb_normal
26
#21 - Joonas Pihlajamaa / @jokkebk

03/16/2014 at 11:33AM

P1000007_normal
27
#22 - h_east (DDD ready) / @h_east

07/25/2012 at 07:26PM

Old-tv-set-thumb206925-751667_normal
27
#23 - Salvador / @smastermind

08/17/2012 at 04:11AM

Emblemofroto_normal
28
#24 - Glen / @Glen_S

07/22/2012 at 01:03PM

3b612fef7e817238b64220cf92195639_normal
29
#25 - Nipunn Koorapati / @nipunn1313

07/21/2012 at 10:56PM

Default_profile_6_normal
29
#26 - Eric Soderstrom / @eksoderstrom

07/23/2012 at 08:26AM

Bc879469f279ee24b7fbdfad7c2216d9_normal
29
#27 - 無ん垢の叫び / @john_ababa

09/16/2012 at 01:09AM

Default_profile_1_normal
31
#28 - Chris Brown / @engineercyb

07/31/2012 at 12:58PM

Twitterprofile_normal
32
#29 - Daniel Lundin / @danielundin

07/20/2012 at 05:15AM

Makala_normal
32
#30 - makala noble / @mnoble01

11/13/2012 at 01:37AM

500daa18db33d9585335c991451ba992_normal
42
#31 - Arto Vuori / @dhpe

08/31/2012 at 11:42AM

08jqb4rz_normal
43
#32 - Yann Moisan / @YannMoisan

01/12/2013 at 09:11AM

E4feb7bc65f40241d40505877e0e9b2f_normal
46
#33 - J Paul Daigle / @jpauldaigle

07/23/2012 at 08:02AM

Image_normal
46
#34 - Слава / @slava_and_ipad

08/08/2012 at 04:17AM

Default_profile_1_normal
50
#35 - Paul Anton Letnes / @Dynetrekk

08/21/2012 at 12:20AM

E2e809f6a507788d5988018ff92a4c3a_normal
51
#36 - Thijs Brobbel / @tiesmaster

07/30/2012 at 02:13AM

Ba1070d8841ff40257904144ae3db536_normal
51
#37 - Ravi S Sinha / @ambidextrousTx

09/09/2012 at 02:34PM

9q3yxp1gliit8k2f2ov0_normal
69
#38 - RusAlex Pletnev / @RusAlexander

07/25/2012 at 12:03PM