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

69 active golfers, 170 entries

Leaderboard (lowest score wins):
23
#1 - Jon Krause / @jkrause314

12/20/2020 at 07:31PM

23
#2 - John Braxler / @braxler

01/29/2021 at 05:28PM

23
#3 - Janzen / @__Coos

10/04/2022 at 10:41AM

23
#4 - Peppa Pig / @PeppaPi95550250

07/02/2024 at 09:10AM

23
#5 - nickGPT / @nickandbro

08/27/2024 at 05:35AM

24
#6 - Urtica dioica / @udioica

07/01/2017 at 04:20PM

24
#7 - Saki Gw / @Sakigw

07/01/2017 at 08:02PM

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

07/08/2017 at 09:01PM

24
#9 - Blake Tereau / @BlakeTereau

07/12/2017 at 06:46PM

24
#10 - huho / @huho_xu

08/03/2017 at 09:58PM

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

09/04/2017 at 01:23AM

24
#12 - Turkey Man / @lvturkeyman

11/11/2017 at 03:04PM

24
#13 - Benoit Mortgat / @Benoit_Mortgat

11/15/2017 at 10:15AM

24
#14 - DHM / @DHM29978992

04/30/2018 at 12:41AM

24
#15 - Mihai / @mihaicristiant

02/01/2019 at 08:14AM

24
#16 - pikjes / @pikjes2

03/25/2021 at 03:11PM

24
#17 - Jean George / @JeanGeo20504212

03/28/2022 at 05:42PM

25
#18 - Smylers / @Smylers2

07/01/2017 at 11:04PM

25
#19 - Ryan Coopersmith / @RyanCoopersmit1

07/02/2017 at 01:14AM

25
#20 - Petro Тrouq / @zulolosi

07/02/2017 at 10:04AM

25
#21 - Michael Brown / @mbrown1413

07/06/2017 at 01:51PM

25
#22 - Dan Simmons / @simmons_dan

07/13/2017 at 02:53PM

25
#23 - Baine Wedlock / @BaineWedlock

08/13/2017 at 07:03PM

25
#24 - Terry Ding / @TerryDing77

08/24/2017 at 11:47AM

25
#25 - Lory / @Lory46845742

12/18/2019 at 01:57PM

25
#26 - Luoyb / @Luoyb

11/15/2023 at 09:14AM

26
#27 - Jon Barker / @j0nbarker

07/13/2017 at 08:29AM

28
#28 - io / @iovis9

07/02/2017 at 12:21PM

28
#29 - Cristian Lupașcu / @clupasq

07/02/2017 at 07:39PM

28
#30 - Brian Hall / @_bruab_

07/03/2017 at 02:30PM