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

73 active golfers, 182 entries

Leaderboard (lowest score wins):
32
#61 - Adrian Englhardt / @_englhardt

07/10/2017 at 02:23PM

32
#62 - Sergio Semedi / @SergioSemedi

07/13/2017 at 11:15PM

32
#63 - sam abtek / @samabtek1

08/04/2017 at 06:44PM

32
#64 - Marcin Paliwoda / @eukaliptuss

08/27/2017 at 02:51PM

32
#65 - Geoff / @RealGeoffErwin

10/09/2017 at 07:02PM

33
#66 - Derek Schrock / @derekschrock

07/01/2017 at 06:02PM

33
#67 - Stop and think / @ms_uncountable

07/07/2017 at 06:01PM

33
#68 - D. 👋 / @DCT_cpp

02/11/2022 at 01:03PM

41
#69 - Jurica / @Jurica34581259

11/20/2018 at 10:52PM

46
#70 - Jiawei Li / @calvin_lee2

01/24/2022 at 06:14AM

50
#71 - Jacob Buete / @JBuete

07/02/2017 at 01:01PM

97
#72 - Miaomiao@.dandan / @Miaomiao_dandan

01/24/2022 at 07:30AM

106
#73 - Vincent Le / @Vinnyoodles

07/02/2017 at 03:49AM