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 31 remaining solutions by signing in and submitting your own entry
#32 agp vim golf / agpvimgolf - Score: 47 - 11/26/12 @ 05:51
:v/  <i/d<CR>0<C-V>7l4kxw<C-V>$4jx:%s/\n/|/g<CR>i^(<Esc>$s).*$<Esc>ZZ

0 comments

#33 Pete Johns / johnsyweb - Score: 50 - 11/27/12 @ 18:08
:v?^\s*<item>?d|%s///<CR><CR>f<C).*$<Esc>qq-;C|<Esc>Jxq2@qI^(<Esc>ZZ

0 comments

#34 mhb / mhbvim - Score: 54 - 11/25/12 @ 09:01
:g!/  <i/d<CR>:%s/[ <\/]\|item>//g<CR>:%s/\n/|<CR>I^(<C-O>$<BS>).*$<Esc>ZZ

0 comments

#35 RusAlex Pletnev / RusAlexander - Score: 58 - 11/27/12 @ 11:14
C^(<C-C><C-C>:g/<!/d<CR>``6J:s/.<item>//g<CR>:s/<.item>/|/g<CR>f8lC).*$<C-C><C-C>ZZ

0 comments

#36 RobertT / techrt2050 - Score: 63 - 10/10/13 @ 05:30
:g/list/d<CR>:g/!--/d<CR>:%s/.*>\([^<]*\)<.*$/\1|<CR>H:%j!<CR>I^(<Esc>$s).*$<Esc>ZZ

0 comments

#37 Runar / runarfu - Score: 68 - 12/03/12 @ 20:42
j"1yitjjj"2yitj"3yitjj"4yitjjo^(<Esc>A<Esc>"1pA|<Esc>"2pA|<Esc>"3pA|<Esc>"4pA).*$<Esc>kdggZZ

0 comments

#38 Romain Endelin / RomainEndelin - Score: 110 - 05/27/13 @ 12:31
n/<!<CR>qqddnq3@q:%s/\s\+<item>//g<CR>:5<BS>$<BS>%s<\/item>\n/|/<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Right><Right><Right><Right><Right><Right><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>/<CR>kcW^)<BS>(jj<BS><BS><Esc>Jx$bbc$).*$<Esc>:wq<CR>

0 comments

#39 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

39 active golfers, 95 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

29
#5 - Conner McDaniel / connermcd

11/26/2012 at 04:30AM

29
#6 - a24f0600 / a24f0600

11/28/2012 at 12:51PM

29
#7 - pftb12345 / pftb12345

04/26/2015 at 02:08PM

31
#8 - Kerson Hsiao / KersonHsiao

11/25/2012 at 09:27AM

31
#9 - Joonas Pihlajamaa / jokkebk

03/19/2014 at 10:20PM

34
#10 - 無ん垢の叫び / john_ababa

11/25/2012 at 11:28AM

34
#11 - Matthieu Crapet / mcr05

01/01/2015 at 08:08PM

35
#12 - Vasil Sakarov / vsakarov

11/25/2012 at 08:17PM

35
#13 - David Barnett / mu_mind

11/26/2012 at 02:08AM

35
#14 - Édouard M'tou / DouardM

12/19/2012 at 07:16PM

35
#15 - Yann Moisan / YannMoisan

01/02/2013 at 09:22PM

36
#16 - Hubba / HubbaBubbaFett

11/26/2012 at 09:57PM

36
#17 - Justin / justinjaffray

04/28/2013 at 04:02PM

37
#18 - Marcin Sza / coot_

11/25/2012 at 09:35AM

38
#19 - Aniket Schneider / shaydwyrm

11/25/2012 at 09:37PM

38
#20 - Pawel Obrok / mrYapee

11/26/2012 at 08:37AM

38
#21 - Premium Ben / muppling

03/10/2013 at 10:08PM

39
#22 - Ben Baker-Smith / Bit_Synthesis

12/14/2012 at 01:59AM

39
#23 - Raphaël Pierquin / perafoo

04/10/2013 at 08:28PM

39
#24 - James / Dronak

09/02/2013 at 11:31PM

41
#25 - Alex Hammel / AlexJHammel

12/24/2012 at 02:07PM

41
#26 - David Kormushoff / Kormie

07/09/2013 at 02:17AM

44
#27 - Harry Garrood / hdgarrood

12/03/2012 at 10:20PM

45
#28 - Jason Wolf / zephyr_wolf

11/29/2012 at 01:34PM

45
#29 - Eric Andres / eric_m_andres

12/04/2012 at 05:28PM

46
#30 - Ravi S Sinha / ambidextrousTx

11/26/2012 at 07:38AM

46
#31 - jDeveloper / jDevEE

11/28/2012 at 11:25PM

47
#32 - agp vim golf / agpvimgolf

11/26/2012 at 05:51AM

50
#33 - Pete Johns / johnsyweb

11/27/2012 at 06:08PM

54
#34 - mhb / mhbvim

11/25/2012 at 09:01AM

58
#35 - RusAlex Pletnev / RusAlexander

11/27/2012 at 11:14AM

63
#36 - RobertT / techrt2050

10/10/2013 at 05:30AM

68
#37 - Runar / runarfu

12/03/2012 at 08:42PM

110
#38 - Romain Endelin / RomainEndelin

05/27/2013 at 12:31PM

229
#39 - Pamela / pamcdm

07/11/2014 at 03:13AM