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 40 remaining solutions by signing in and submitting your own entry
#41 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

41 active golfers, 101 entries

Leaderboard (lowest score wins):
46
#31 - Ravi S Sinha / @ambidextrousTx

11/26/2012 at 07:38AM

46
#32 - jDeveloper / @jDevEE

11/28/2012 at 11:25PM

47
#33 - agp vim golf / @agpvimgolf

11/26/2012 at 05:51AM

50
#34 - Pete Johns / @johnsyweb

11/27/2012 at 06:08PM

54
#35 - mhb / @mhbvim

11/25/2012 at 09:01AM

58
#36 - RusAlex Pletnev / @RusAlexander

11/27/2012 at 11:14AM

63
#37 - RobertT / @techrt2050

10/10/2013 at 05:30AM

68
#38 - Runar / @runarfu

12/03/2012 at 08:42PM

68
#39 - Paul Inc / @hiniol1982

08/15/2017 at 08:12AM

110
#40 - Romain Endelin / @RomainEndelin

05/27/2013 at 12:31PM

229
#41 - Pamela / @pamcdm

07/11/2014 at 03:13AM