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 9v0066fde7b000000000046f

extract struct tag in go

Can you extract all struct tags in the fewest keystrokes possible?

Start file
import "time"

type
User struct {
        ID            
int       `json:"id" db:"user_id"`
       
Name           string    `json:"name" db:"username"`
       
Email          string    `json:"email" db:"email"`
       
CreatedAt      time.Time `json:"created_at" db:"created_at"`
       
Password       string    `json:"-" db:"password"` // Omit password from JSON serialization
       
Address        string    `json:"address" db:"address"`
       
City           string    `json:"city" db:"city"`
       
State          string    `json:"state" db:"state"`
       
Country        string    `json:"country" db:"country"`
       
ZipCode        string    `json:"zip_code" db:"zip_code"`
       
PhoneNumber    string    `json:"phone_number" db:"phone_number"`
       
ProfilePicture string    `json:"profile_picture" db:"profile_picture"`
       
Roles          []string  `json:"roles" db:"roles"`
       
CreatedAt      time.Time `json:"created_at" db:"created_at"`
       
UpdatedAt      time.Time `json:"updated_at" db:"updated_at"`
}
End file
import "time"

type
User struct {
        ID            
int       `json:"id" db:"user_id"`
       
Name           string    `json:"name" db:"username"`
       
Email          string    `json:"email" db:"email"`
       
CreatedAt      time.Time `json:"created_at" db:"created_at"`
       
Password       string    `json:"-" db:"password"` // Omit password from JSON serialization
       
Address        string    `json:"address" db:"address"`
       
City           string    `json:"city" db:"city"`
       
State          string    `json:"state" db:"state"`
       
Country        string    `json:"country" db:"country"`
       
ZipCode        string    `json:"zip_code" db:"zip_code"`
       
PhoneNumber    string    `json:"phone_number" db:"phone_number"`
       
ProfilePicture string    `json:"profile_picture" db:"profile_picture"`
       
Roles          []string  `json:"roles" db:"roles"`
       
CreatedAt      time.Time `json:"created_at" db:"created_at"`
       
UpdatedAt      time.Time `json:"updated_at" db:"updated_at"`
}
{"user_id", "username", "email", "password", "address", "city", "state", "country", "zip_code", "phone_number", "profile_picture", "roles", "created_at", "updated_at"}

View Diff

19a20
> {"user_id", "username", "email", "password", "address", "city", "state", "country", "zip_code", "phone_number", "profile_picture", "roles", "created_at", "updated_at"}

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 28 remaining solutions by signing in and submitting your own entry
#29 Adrien Beudin / @beudbeud - Score: 91 - 03/13/25 @ 16:11
:let @a='' | %s/db:\(.*\)`/\=setreg('A', mat<BS><BS><BS>submatch(1) . ", ")/n<CR>Go{<C-R>a<BS><BS>}<Esc><Home>9w3<Esc>d3w<Esc>:wq<CR>

0 comments


Created by: @__ngtrongkha

29 active golfers, 89 entries

Leaderboard (lowest score wins):
29
#1 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

12/01/2024 at 08:42PM

29
#2 - Peppa Pig / @PeppaPigSg

12/07/2024 at 05:40AM

33
#3 - JMTed / @JMTed

10/04/2024 at 08:31AM

33
#4 - rasputins / @rasputins

10/16/2024 at 07:37PM

33
#5 - John Braxler / @braxler

10/17/2024 at 07:45PM

33
#6 - ak@developer / @Ajay-056

10/20/2024 at 06:12AM

33
#7 - 0xf00ff00f / @0xf00ff00f

02/09/2025 at 08:36PM

33
#8 - Leon Kacowicz / @leonkacowicz

05/05/2025 at 06:02PM

33
#9 - jimmymills / @jimmymills

05/15/2025 at 06:24PM

35
#10 - Roger Stoltz / @rogsto1

10/22/2024 at 04:13PM

38
#11 - SnakitoGamer4160 / @SnakitoGamer4160

11/08/2024 at 09:38PM

38
#12 - thedvd98 / @thedvd98

11/18/2024 at 08:48PM

38
#13 - migoohao / @migoohao

06/23/2025 at 08:18AM

39
#14 - Rodi-Janssen / @Rodi-Janssen

11/11/2024 at 02:08PM

40
#15 - Pablo Acuna / @pacuna

10/03/2024 at 06:14PM

40
#16 - Neix20 / @Neix20

10/07/2024 at 06:44AM

41
#17 - Melih Aktop / @mlhktp

11/02/2024 at 05:53PM

41
#18 - winter-loo / @winter-loo

05/29/2025 at 10:52AM

42
#19 - Abdelrahman Madkour / @a3madkour

04/09/2025 at 06:11PM

46
#20 - nduncan227 / @nduncan227

04/26/2025 at 01:04AM

46
#21 - Damien Baldy / @dbaldy

05/19/2025 at 01:56PM

47
#22 - Haruaki Tomida / @haruyan-hopemucci

12/11/2024 at 03:49AM

47
#23 - lei / @oizhaolei

01/18/2025 at 03:00AM

48
#24 - Luiz Carlos Vartuli / @ziul123

06/05/2025 at 11:14PM

49
#25 - Philippe Carphin / @PhilippeCarphin

10/15/2024 at 02:02AM

52
#26 - Michael Cuffaro / @maiku1008

11/23/2024 at 06:12PM

69
#27 - SRINIVASU SALADI / @SRINIVASUS22587

03/24/2025 at 04:10AM

80
#28 - Alex Mihov / @AlexMihov

10/25/2024 at 09:49AM

91
#29 - Adrien Beudin / @beudbeud

03/13/2025 at 04:11PM