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 5957c3356f7e17045b00002c

Add Go XML to structure tags

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

Start file
package main

// FooXML mapping from XML to struct
type FooXML struct {
	Field1 string
	Field2 string
	Field3 string
}
End file
package main

// FooXML mapping from XML to struct
type FooXML struct {
	Field1 string `xml:"field1"`
	Field2 string `xml:"field2"`
	Field3 string `xml:"field3"`
}

View Diff

5,7c5,7
< 	Field1 string
< 	Field2 string
< 	Field3 string
---
> 	Field1 string `xml:"field1"`
> 	Field2 string `xml:"field2"`
> 	Field3 string `xml:"field3"`

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 32 remaining solutions by signing in and submitting your own entry
#33 grigouille / grigouille2 - Score: 32 - 07/03/17 @ 20:05
5GA `xml:"field1"`<Esc>j.j.hhr3kr2ZZ

0 comments

#34 Dick Quixly / DickQuixly - Score: 32 - 07/06/17 @ 00:28
5GA `xml:"field1"`<Esc>j.j.ger3kr2ZZ

0 comments

#35 Adrian Englhardt / _englhardt - Score: 32 - 07/10/17 @ 14:23
5GqqyiwA `xml:""`<Esc>hPFF~FFjq2@qZZ

0 comments

#36 Sergio Semedi / SergioSemedi - Score: 32 - 07/13/17 @ 23:15
5GA `xml:"field1"`<Esc>j.j.Tdr3kr2ZZ

0 comments

#37 Derek Schrock / derekschrock - Score: 33 - 07/01/17 @ 18:02
qq/Fi<CR>yw$a `xml:"<Esc>pr"a`<Esc>FF~q2@qZZ

0 comments

#38 Stop and think / ms_uncountable - Score: 33 - 07/07/17 @ 18:01
5G$<C-V>2jA `xml:"field1"`<Esc>jf1r2jr3ZZ

0 comments

#39 Jacob Buete / JBuete - Score: 50 - 07/02/17 @ 13:01
:%s/\(Field\(\d\) string\)/\1 `xml:"field\2"`/g<CR>ZZ

0 comments

#40 Vincent Le / Vinnyoodles - Score: 106 - 07/02/17 @ 03:49
Gkkkjk$a <BS><Esc>bbBjjkbbBBBBBBBBjjbbbbjbBBBBjll$<C-V>jj<Esc>kkl<C-V>jjI <BS>g `xml: <BS>"field`"`<BS><BS><BS>1"`<Esc>jk$a<BS><Esc>jlxjlxhhkr2jr3<Esc>:wq<CR>

0 comments

Created by: KaizenSoze70

40 active golfers, 86 entries

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

07/01/2017 at 04:20PM

24
#2 - Saki Gw / Sakigw

07/01/2017 at 08:02PM

24
#3 - Михаил Добров / mSuGfwFz2ZNvv5b

07/08/2017 at 09:01PM

24
#4 - Blake Tereau / BlakeTereau

07/12/2017 at 06:46PM

25
#5 - Smylers / Smylers2

07/01/2017 at 11:04PM

25
#6 - Ryan Coopersmith / RyanCoopersmit1

07/02/2017 at 01:14AM

25
#7 - Petro Тrouq / zulolosi

07/02/2017 at 10:04AM

25
#8 - Michael Brown / mbrown1413

07/06/2017 at 01:51PM

25
#9 - Dan Simmons / simmons_dan

07/13/2017 at 02:53PM

26
#10 - Jon Barker / j0nbarker

07/13/2017 at 08:29AM

28
#11 - io / iovis9

07/02/2017 at 12:21PM

28
#12 - Cristian Lupașcu / clupasq

07/02/2017 at 07:39PM

28
#13 - Brian Hall / _bruab_

07/03/2017 at 02:30PM

28
#14 - Andreas Bricelj / mcbric

07/04/2017 at 05:34PM

28
#15 - Anne Pacalet / _Anne_P

07/07/2017 at 10:42AM

28
#16 - Gurukandhamoorthi / Gurukandhamoor1

07/09/2017 at 01:56PM

28
#17 - Ryan McNamara / MadDogMcNamara

07/16/2017 at 01:38AM

29
#18 - Cristian / cris_perez_b

07/02/2017 at 04:21PM

29
#19 - Harsh Kumar / datsleepyguy

07/02/2017 at 05:52PM

29
#20 - Barnaby Colby / BarnabyColby

07/02/2017 at 07:40PM

30
#21 - 杨洋 / 176795444

07/02/2017 at 02:21AM

30
#22 - Ivan Poroliev / p0pac

07/02/2017 at 06:22AM

30
#23 - John Marks / __jmarks

07/03/2017 at 09:19PM

30
#24 - Kieron Browne / KieronBrowne1

07/06/2017 at 10:28AM

30
#25 - Andrei Gasparovici / AGasparovici

07/06/2017 at 04:16PM

30
#26 - Christian Panadero / PaNaVTEC

07/15/2017 at 01:25PM

31
#27 - AleksandarTrifunovic / akstrfn

07/01/2017 at 04:27PM

31
#28 - Christian Stammen / c0smiq

07/01/2017 at 07:19PM

31
#29 - Bennett Bernardoni / BBernardoni

07/02/2017 at 03:58AM

31
#30 - J / J02108006

07/02/2017 at 11:04AM

31
#31 - Scott Mills / smm1729

07/11/2017 at 01:57AM

32
#32 - Anoop Kumar / anooplive

07/01/2017 at 11:14PM

32
#33 - grigouille / grigouille2

07/03/2017 at 08:05PM

32
#34 - Dick Quixly / DickQuixly

07/06/2017 at 12:28AM

32
#35 - Adrian Englhardt / _englhardt

07/10/2017 at 02:23PM

32
#36 - Sergio Semedi / SergioSemedi

07/13/2017 at 11:15PM

33
#37 - Derek Schrock / derekschrock

07/01/2017 at 06:02PM

33
#38 - Stop and think / ms_uncountable

07/07/2017 at 06:01PM

50
#39 - Jacob Buete / JBuete

07/02/2017 at 01:01PM

106
#40 - Vincent Le / Vinnyoodles

07/02/2017 at 03:49AM