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 50b1d7239aad89000200002d

Extract text from xml

Extract text from xml file (ignoring commented out elements) and create a one line regex.

Start file
<list>
  <item>txt123</item>
  <!-- <item>txt124</item> -->
  <!-- <item>txt126</item> -->
  <item>txt127</item>
  <item>txt137</item>
  <!-- <item>txt145</item> -->
  <item>txt148</item>
  <!-- <item>txt150</item> -->
</list>
End file
^(txt123|txt127|txt137|txt148).*$

View Diff

1,10c1
< <list>
<   <item>txt123</item>
<   <!-- <item>txt124</item> -->
<   <!-- <item>txt126</item> -->
<   <item>txt127</item>
<   <item>txt137</item>
<   <!-- <item>txt145</item> -->
<   <item>txt148</item>
<   <!-- <item>txt150</item> -->
< </list>
---
> ^(txt123|txt127|txt137|txt148).*$

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 45 remaining solutions by signing in and submitting your own entry
#46 Pamela / @pamcdm - Score: 229 - 07/11/14 @ 03:13
/<!--<CR>ddn.n.n./txt123i<BS><CR>i<CR><Esc>e<Right>i<CR>uu<Esc>ui|<CR>d<Esc>ddidw<Esc>dwdwdwwi<BS><BS><BS><BS><BS><Esc>wwd$i|<Esc>u<Right>i|u<Esc>u<Right>a|<Down>di><Esc>di>d$d$a|<Esc>/item <BS>dw<CR><CR>/item<CR>nd$dwdwndwddwndwi<BS><BS><BS><BS>dw<Esc>dwdw<BS>dwux<Down>0dt>xi<BS><Esc>ea)<Esc>0wAA<Esc>u0 i(x<BS><BS><Right>(<Tab>u<Esc>u(<Down><Right><Right>i(<Esc><Up>d$xx^i^<Esc><Down>i<Right><Right><BS><BS><BS>:2<CR><Esc>u<Esc>uuddi<BS><BS>^<Esc><Down>dd0eeee$a.*$<Esc>:x<CR>

0 comments


Created by: @mhbvim

46 active golfers, 127 entries

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

12/13/2012 at 01:47PM

28
#2 - Armin / @twistedcommons

02/11/2013 at 04:00AM

28
#3 - Petro Тrouq / @zulolosi

03/13/2013 at 11:10PM

28
#4 - John Braxler / @braxler

08/05/2014 at 05:21PM

28
#5 - Ben Hill / @KaizenSoze70

10/11/2017 at 05:08PM

28
#6 - Peppa Pig / @PeppaPigSg

07/03/2024 at 06:25AM

28
#7 - nickGPT / @nickandbro

08/28/2024 at 07:23PM

29
#8 - Conner McDaniel / @connermcd

11/26/2012 at 04:30AM

29
#9 - a24f0600 / @a24f0600

11/28/2012 at 12:51PM

29
#10 - pftb12345 / @pftb12345

04/26/2015 at 02:08PM

31
#11 - Kerson Hsiao / @KersonHsiao

11/25/2012 at 09:27AM

31
#12 - Joonas Pihlajamaa / @jokkebk

03/19/2014 at 10:20PM

34
#13 - じょんあば / @john_ababa

11/25/2012 at 11:28AM

34
#14 - Matt / @mcr05

01/01/2015 at 08:08PM

35
#15 - Vasil Sakarov / @vsakarov

11/25/2012 at 08:17PM

35
#16 - David Barnett / @mu_mind

11/26/2012 at 02:08AM

35
#17 - Édouard M'tou / @DouardM

12/19/2012 at 07:16PM

35
#18 - Yann Moisan / @YannMoisan

01/02/2013 at 09:22PM

36
#19 - Hubba / @HubbaBubbaFett

11/26/2012 at 09:57PM

36
#20 - Justin / @justinjaffray

04/28/2013 at 04:02PM

37
#21 - Marcin Szamotulski / @me_coot

11/25/2012 at 09:35AM

38
#22 - Aniket Schneider / @shaydwyrm

11/25/2012 at 09:37PM

38
#23 - Pawel Obrok / @mrYapee

11/26/2012 at 08:37AM

38
#24 - Tact Overflow / @muppling

03/10/2013 at 10:08PM

39
#25 - Ben Baker-Smith / @Bit_Synthesis

12/14/2012 at 01:59AM

39
#26 - Raphaël Pierquin / @perafoo

04/10/2013 at 08:28PM

39
#27 - James / @Dronak

09/02/2013 at 11:31PM

40
#28 - Qing Liu / @poeminlash

11/07/2022 at 05:21AM

41
#29 - ajh / @AlexJHammel

12/24/2012 at 02:07PM

41
#30 - David Kormushoff / @Kormie

07/09/2013 at 02:17AM