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

48 active golfers, 129 entries

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

06/25/2015 at 08:40PM

22
#2 - Sebastian Kusnier / @skusnier

07/22/2012 at 04:38PM

22
#3 - Frank Twitting / @knarfben

07/23/2012 at 01:56PM

22
#4 - wes / @_weslly

07/23/2012 at 03:00PM

22
#5 - James Davis / @tripvg

08/14/2012 at 04:07AM

22
#6 - John Braxler / @braxler

07/31/2014 at 08:47PM

22
#7 - Daniël De Koker / @daniel_koker

07/18/2018 at 03:29PM

23
#8 - Conner McDaniel / @connermcd

07/20/2012 at 03:40AM

23
#9 - Tim Chase / @gumnos

07/20/2012 at 01:27PM

24
#10 - Kerson Hsiao / @KersonHsiao

07/20/2012 at 09:20AM

24
#11 - Justin Love / @wondible

07/20/2012 at 01:34PM

24
#12 - q_revert / @q_revert

07/20/2012 at 02:21PM

24
#13 - Raúl Jara / @rauljara

07/20/2012 at 04:42PM

24
#14 - Peter Anselmo / @peter_anselmo

07/28/2012 at 03:25PM

24
#15 - Sean Griffin / @sgrif

08/12/2012 at 11:25PM

24
#16 - 刘玮 / @lwjef

08/17/2012 at 12:30AM

24
#17 - Rod Knowlton / @codelahoma

08/17/2012 at 09:13PM

24
#18 - Édouard M'tou / @DouardM

10/09/2012 at 07:59AM

24
#19 - Victor Ramirez / @virako

10/18/2012 at 01:08AM

24
#20 - pftb12345 / @pftb12345

04/28/2015 at 11:31PM

25
#21 - Sebastian Korten / @FlashKorten

07/20/2012 at 07:06AM

25
#22 - Steve Tjoa / @stevetjoa

08/09/2013 at 09:40PM

25
#23 - jolka / @jolka19296078

05/23/2014 at 11:50PM

25
#24 - Tamas Gal (Tom) / @tamasgal

09/28/2015 at 01:33PM

26
#25 - Joonas Pihlajamaa / @jokkebk

03/16/2014 at 06:33PM

27
#26 - h_east (トロッコ6個) / @h_east

07/26/2012 at 02:26AM

27
#27 - Salvador / @smastermind

08/17/2012 at 11:11AM

28
#28 - Glen / @Glen_S

07/22/2012 at 08:03PM

29
#29 - Nipunn Koorapati / @nipunn1313

07/22/2012 at 05:56AM

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

07/23/2012 at 03:26PM