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):
38
#31 - Benjamin Schindler / @beschindler

02/11/2017 at 09:01AM

38
#32 - Daniel / @Daniel00288663

03/29/2017 at 08:52AM

38
#33 - chu zui / @chuzui7

05/15/2017 at 12:22PM

38
#34 - Benoit Benoit / @Benoit_Tgt

06/08/2017 at 05:24PM

38
#35 - adeel hussain / @adeelhussain

07/27/2017 at 05:21PM

38
#36 - Brandon Height / @Lask0x

08/09/2017 at 09:22PM

39
#37 - jonas-grobe / @jonas-grobe

02/03/2024 at 09:38PM

41
#38 - RockerZZY / @rocker_zzy

06/13/2020 at 03:07PM

43
#39 - vimgolfaccfekxh / @vimgolfaccfekxh

10/30/2022 at 04:17PM

44
#40 - jack / @jack28887741

02/24/2017 at 11:58AM

45
#41 - Avimgolfer / @l718232

01/30/2017 at 04:58PM

45
#42 - Zhihong Liu / @pieapple03

02/05/2017 at 02:26PM

45
#43 - c0llision / @sh3llcode

01/28/2018 at 04:28PM

52
#44 - Matt Walsh / @wattmalsh

02/06/2017 at 02:54AM