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 58860440c57fb30006000004

Extract HTML option values from tag values

Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.

Start file
<select>
  <option>Volvo</option>
  <option>Aston Martin</option>
  <option>Audi</option>
  <option>Alfa Romeo</option>
</select>
End file
<select>
  <option value="volvo">Volvo</option>
  <option value="aston_martin">Aston Martin</option>
  <option value="audi">Audi</option>
  <option value="alfa_romeo">Alfa Romeo</option>
</select>

View Diff

2,5c2,5
<   <option>Volvo</option>
<   <option>Aston Martin</option>
<   <option>Audi</option>
<   <option>Alfa Romeo</option>
---
>   <option value="volvo">Volvo</option>
>   <option value="aston_martin">Aston Martin</option>
>   <option value="audi">Audi</option>
>   <option value="alfa_romeo">Alfa Romeo</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 43 remaining solutions by signing in and submitting your own entry
#44 Matt Walsh / @wattmalsh - Score: 52 - 02/06/17 @ 02:54
qqj0f>lyithi value=""<Esc>hpvi"uvi":s/\%V /_/g<CR>q@q@@@@ZZ

0 comments


Created by: @kevgathuku

44 active golfers, 110 entries

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

01/23/2017 at 03:36PM

34
#2 - Smylers / @Smylers2

01/23/2017 at 07:43PM

34
#3 - Saki Gw / @Sakigw

01/24/2017 at 06:04PM

34
#4 - ben eisner / @b_eisner

02/09/2017 at 09:06AM

34
#5 - Evgeny`s Kindle / @EvgenyKindle

03/19/2017 at 09:31AM

34
#6 - Maricris Bonzo / @seemcat

09/20/2017 at 10:44PM

34
#7 - Turkey Man / @lvturkeyman

11/26/2017 at 10:11AM

34
#8 - John Braxler / @braxler

06/14/2021 at 01:01PM

34
#9 - Peppa Pig / @PeppaPi95550250

07/02/2024 at 09:46AM

34
#10 - nickGPT / @nickandbro

08/28/2024 at 02:56AM

35
#11 - Jean George / @JeanGeo20504212

06/20/2022 at 04:49PM

35
#12 - moh ayaya / @AyayaMoh

09/26/2023 at 05:16PM

35
#13 - Luoyb / @Luoyb

11/17/2023 at 05:38AM

36
#14 - Kai Yuan / @kentyuan

01/23/2017 at 02:34PM

36
#15 - Song Zheng / @songz

09/13/2017 at 11:45PM

36
#16 - ナイト / @ndknight

03/11/2018 at 12:17PM

36
#17 - DHM / @DHM29978992

05/21/2018 at 01:05AM

36
#18 - roudens / @roudens2

03/11/2021 at 02:06PM

36
#19 - Janzen / @__Coos

10/04/2022 at 11:36AM

37
#20 - tPenguinLTG / @tpenguinltg

01/24/2017 at 01:58AM

37
#21 - Jan Bundesmann / @janbundesmann

01/25/2017 at 01:39PM

37
#22 - Gurukandhamoorthi / @Gurukandhamoor1

07/16/2017 at 02:43PM

37
#23 - e_e / @eleloi

02/20/2023 at 11:30PM

38
#24 - Cristian Lupașcu / @clupasq

01/23/2017 at 02:06PM

38
#25 - ZW / @ZW73226885

01/24/2017 at 06:40PM

38
#26 - leslie snipes / @imjakerl

01/25/2017 at 05:35AM

38
#27 - Jakob / @jajob

01/27/2017 at 08:09AM

38
#28 - Tarcísio Gruppi / @txgruppi

01/28/2017 at 11:33PM

38
#29 - Marko / @ultrox

01/29/2017 at 10:46AM

38
#30 - Avian Y / @y_avian

02/05/2017 at 08:48PM