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):
44
#31 - harry 🏳️‍🌈 / @hdgarrood

12/03/2012 at 10:20PM

45
#32 - Jason Wolf / @zephyr_wolf

11/29/2012 at 01:34PM

45
#33 - Eric Andres / @eric_m_andres

12/04/2012 at 05:28PM

45
#34 - POSIX / @po6ix

01/22/2022 at 03:32PM

46
#35 - Ravi S Sinha / @ambidextrousTx

11/26/2012 at 07:38AM

46
#36 - jDeveloper / @jDevEE

11/28/2012 at 11:25PM

47
#37 - agp vim golf / @agpvimgolf

11/26/2012 at 05:51AM

50
#38 - Pete Johns / @johnsyweb

11/27/2012 at 06:08PM

54
#39 - mhb / @mhbvim

11/25/2012 at 09:01AM

58
#40 - RusAlex Pletnev / @RusAlexander

11/27/2012 at 11:14AM

63
#41 - RobertT / @techrt2050

10/10/2013 at 05:30AM

68
#42 - Runar / @runarfu

12/03/2012 at 08:42PM

68
#43 - Paul Inc / @hiniol1982

08/15/2017 at 08:12AM

71
#44 - shahanavaz m / @shahanavazm

04/04/2024 at 05:54PM

110
#45 - Romain Endelin / @RomainEndelin

05/27/2013 at 12:31PM

229
#46 - Pamela / @pamcdm

07/11/2014 at 03:13AM