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 5c1db460c5949f000990a2f1

My cafe needs a new menu

Help! My cafe needs a new menu and I've only got this plain-text file from the kitchen. In order to get it printed, I need to transform it into a markdown file with; headings for each type of item, prices on each menu item, dietary options and a key down the bottom.

Start file
mocha drink 4
tea drink
3
iced
-tea drink 5
iced
-mocha drink 5
eggs
-on-toast breakfast gluten-free-option,vegetarian 14
bacon
-and-eggs breakfast 16
vegan
-deluxe breakfast gluten-free-option,vegetarian 14
meaty
-deluxe breakfast 20
big
-burger lunch gluten-free-option,vegetarian-option 14
steak
-and-chips lunch 22
End file
# Drink
- Mocha - $4
- Tea - $3
- Iced Tea - $5
- Iced Mocha - $5

# Breakfast
- Eggs On Toast (GFO,V) - $14
- Bacon And Eggs - $16
- Vegan Deluxe (GFO,V) - $14
- Meaty Deluxe - $20

# Lunch
- Big Burger (GFO,VO) - $14
- Steak And Chips - $22

> *GFO = Gluten Free Option, V = Vegetarian, VO = Vegetarian Option

View Diff

1,10c1,17
< mocha drink 4
< tea drink 3
< iced-tea drink 5
< iced-mocha drink 5
< eggs-on-toast breakfast gluten-free-option,vegetarian 14
< bacon-and-eggs breakfast 16
< vegan-deluxe breakfast gluten-free-option,vegetarian 14
< meaty-deluxe breakfast 20
< big-burger lunch gluten-free-option,vegetarian-option 14
< steak-and-chips lunch 22
---
> # Drink
> - Mocha - $4
> - Tea - $3
> - Iced Tea - $5
> - Iced Mocha - $5
>
> # Breakfast
> - Eggs On Toast (GFO,V) - $14
> - Bacon And Eggs - $16
> - Vegan Deluxe (GFO,V) - $14
> - Meaty Deluxe - $20
>
> # Lunch
> - Big Burger (GFO,VO) - $14
> - Steak And Chips - $22
>
> > *GFO = Gluten Free Option, V = Vegetarian, VO = Vegetarian Option

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 7 remaining solutions by signing in and submitting your own entry
#8 Bennett / @bennettbackward - Score: 189 - 12/22/18 @ 10:59
<C-V>9jI- <Esc>O# Drink<CR><CR># Breakfast<CR><CR># Lunch<Esc><CR>qq/\d<CR>i- $<Esc><CR>q9@q^qqWWyy*pWWdW``ddq9@q:%s/\v(\w)(\w*)[- ,]/\u\1\2 /g<CR>o<CR>> *GFO = <Esc>3kfGct-(GFO,VO) <Esc>GA<C-R>"<C-O>FV<BS>, V = <C-O>yw<C-O>P<BS>, VO = <Esc>$x7kFGct-(GFO,V) <Esc>kkFG.ZZ

0 comments


Created by: @bennettbackward

8 active golfers, 31 entries

Leaderboard (lowest score wins):
126
#1 - vimgolfer / @vimgolfer7

10/03/2019 at 07:31AM

126
#2 - Peppa Pig / @PeppaPigSg

07/20/2024 at 12:30AM

126
#3 - nickGPT / @nickandbro

08/25/2024 at 02:53AM

148
#4 - Luoyb / @Luoyb

11/03/2023 at 02:48AM

151
#5 - Filipe Brandenburger / @filbranden

07/08/2019 at 04:57AM

156
#6 - 𝚃𝚒𝚝𝚘𝚞𝚊𝚗 𝚃𝚎𝚢𝚜𝚜𝚒𝚎𝚛 / @TitouanT_

08/11/2019 at 12:29AM

157
#7 - tPenguinLTG / @tpenguinltg

12/23/2018 at 05:50AM

189
#8 - Bennett / @bennettbackward

12/22/2018 at 10:59AM