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

53 active golfers, 122 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

24
#5 - huho / @huho_xu

08/03/2017 at 09:58PM

24
#6 - bazkila@gmail.com / @bazkila

09/04/2017 at 01:23AM

24
#7 - Turkey Man / @lvturkeyman

11/11/2017 at 03:04PM

24
#8 - Benoit Mortgat / @Benoit_Mortgat

11/15/2017 at 10:15AM

24
#9 - DHM / @DHM29978992

04/30/2018 at 12:41AM

25
#10 - Smylers / @Smylers2

07/01/2017 at 11:04PM

25
#11 - Ryan Coopersmith / @RyanCoopersmit1

07/02/2017 at 01:14AM

25
#12 - Petro Тrouq / @zulolosi

07/02/2017 at 10:04AM

25
#13 - Michael Brown / @mbrown1413

07/06/2017 at 01:51PM

25
#14 - Dan Simmons / @simmons_dan

07/13/2017 at 02:53PM

25
#15 - Baine Wedlock / @BaineWedlock

08/13/2017 at 07:03PM

25
#16 - Terry Ding / @TerryDing77

08/24/2017 at 11:47AM

26
#17 - Jon Barker / @j0nbarker

07/13/2017 at 08:29AM

28
#18 - io / @iovis9

07/02/2017 at 12:21PM

28
#19 - Cristian Lupașcu / @clupasq

07/02/2017 at 07:39PM

28
#20 - Brian Hall / @_bruab_

07/03/2017 at 02:30PM

28
#21 - Andreas Bricelj / @mcbric

07/04/2017 at 05:34PM

28
#22 - Anne Pacalet / @_Anne_P

07/07/2017 at 10:42AM

28
#23 - Gurukandhamoorthi / @Gurukandhamoor1

07/09/2017 at 01:56PM

28
#24 - Ryan McNamara / @MadDogMcNamara

07/16/2017 at 01:38AM

29
#25 - Cristian / @cris_perez_b

07/02/2017 at 04:21PM

29
#26 - Harsh Kumar / @datsleepyguy

07/02/2017 at 05:52PM

29
#27 - Barnaby Colby / @BarnabyColby

07/02/2017 at 07:40PM

30
#28 - 杨洋 / @176795444

07/02/2017 at 02:21AM

30
#29 - Ivan Poroliev / @p0pac

07/02/2017 at 06:22AM

30
#30 - John Marks / @__jmarks

07/03/2017 at 09:19PM