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

65 active golfers, 151 entries

Leaderboard (lowest score wins):
28
#31 - Ryan McNamara / @MadDogMcNamara

07/16/2017 at 01:38AM

29
#32 - Cristian / @cris_perez_b

07/02/2017 at 04:21PM

29
#33 - Harsh Kumar / @datsleepyguy

07/02/2017 at 05:52PM

29
#34 - Barnaby Colby / @BarnabyColby

07/02/2017 at 07:40PM

29
#35 - RockerZZY / @rocker_zzy

07/05/2020 at 03:05AM

30
#36 - 杨洋 / @176795444

07/02/2017 at 02:21AM

30
#37 - Ivan Poroliev / @p0pac

07/02/2017 at 06:22AM

30
#38 - John Marks / @__jmarks

07/03/2017 at 09:19PM

30
#39 - Kieron Browne / @KieronBrowne1

07/06/2017 at 10:28AM

30
#40 - Andrei Gasparovici / @agasparovici

07/06/2017 at 04:16PM

30
#41 - Christian Panadero / @PaNaVTEC

07/15/2017 at 01:25PM

30
#42 - James / @Dronak

08/27/2017 at 01:28AM

30
#43 - Alon L / @0xa10

08/28/2017 at 01:53PM

31
#44 - AleksandarTrifunovic / @akstrfn

07/01/2017 at 04:27PM

31
#45 - Christian Stammen / @c0smiq

07/01/2017 at 07:19PM

31
#46 - Bennett Bernardoni / @BBernardoni

07/02/2017 at 03:58AM

31
#47 - Pfhor / @PfhorShark

07/02/2017 at 11:04AM

31
#48 - Scott Mills / @smm1729

07/11/2017 at 01:57AM

31
#49 - 黒澤亮二 / @rjkuro

07/24/2017 at 03:21PM

32
#50 - Anoop Kumar / @anooplive

07/01/2017 at 11:14PM

32
#51 - grigouille / @grigouille2

07/03/2017 at 08:05PM

32
#52 - Dick Quixly / @DickQuixly

07/06/2017 at 12:28AM

32
#53 - Adrian Englhardt / @_englhardt

07/10/2017 at 02:23PM

32
#54 - Sergio Semedi / @SergioSemedi

07/13/2017 at 11:15PM

32
#55 - sam abtek / @samabtek1

08/04/2017 at 06:44PM

32
#56 - Marcin Paliwoda / @eukaliptuss

08/27/2017 at 02:51PM

32
#57 - Geoff / @RealGeoffErwin

10/09/2017 at 07:02PM

33
#58 - Derek Schrock / @derekschrock

07/01/2017 at 06:02PM

33
#59 - Stop and think / @ms_uncountable

07/07/2017 at 06:01PM

33
#60 - D. 👋 / @DCT_cpp

02/11/2022 at 01:03PM