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 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 51 remaining solutions by signing in and submitting your own entry
#52 RusAlex Pletnev / @RusAlexander - Score: 69 - 07/25/12 @ 19:03
/* <CR>r1yawqqnvp<C-A><Esc>ur2nr3nnr4uuuur1nr2nr3nr<Esc><Esc>nr4nr5nr6nr7nr8:%s/\d/&.<CR>ZZ

0 comments


Created by: @connermcd

52 active golfers, 141 entries

Leaderboard (lowest score wins):
29
#31 - Nipunn Koorapati / @nipunn1313

07/22/2012 at 05:56AM

29
#32 - Eric Söderström / @eksoderstrom

07/23/2012 at 03:26PM

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

09/16/2012 at 08:09AM

30
#34 - Sebastian Heil / @sebokopter

10/31/2015 at 01:24AM

31
#35 - Chris Brown / @engineercyb

07/31/2012 at 07:58PM

32
#36 - Daniel Lundin / @danielundin

07/20/2012 at 12:15PM

32
#37 - makala noble / @mnoble01

11/13/2012 at 09:37AM

38
#38 - James / @Dronak

09/24/2014 at 09:55PM

38
#39 - Phoon / @justflashhim

05/12/2019 at 04:25PM

42
#40 - Arto Vuori / @dhpe

08/31/2012 at 06:42PM

42
#41 - Jon Krause / @jkrause314

10/20/2015 at 03:51AM

42
#42 - NeoVimEmacs / @VimNeo

09/28/2019 at 03:15PM

43
#43 - Yann Moisan / @YannMoisan

01/12/2013 at 05:11PM

44
#44 - Lukas Matt / @zauberstuhl

10/31/2015 at 12:31AM

46
#45 - J Paul Daigle / @philosodad

07/23/2012 at 03:02PM

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

08/08/2012 at 11:17AM

46
#47 - Aurélien Deharbe / @0x_ad

06/01/2015 at 12:23PM

48
#48 - Ben Hill / @KaizenSoze70

05/10/2016 at 11:43AM

50
#49 - Paul Anton Letnes / @Dynetrekk

08/21/2012 at 07:20AM

51
#50 - Thijs Brobbel / @tiesmaster

07/30/2012 at 09:13AM

51
#51 - Ravi S Sinha / @ambidextrousTx

09/09/2012 at 09:34PM

69
#52 - RusAlex Pletnev / @RusAlexander

07/25/2012 at 07:03PM