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

22 active golfers, 56 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

35
#8 - Roger Stoltz / @rogsto1

10/22/2024 at 04:13PM

38
#9 - SnakitoGamer4160 / @SnakitoGamer4160

11/08/2024 at 09:38PM

38
#10 - thedvd98 / @thedvd98

11/18/2024 at 08:48PM

39
#11 - Rodi-Janssen / @Rodi-Janssen

11/11/2024 at 02:08PM

40
#12 - Pablo Acuna / @pacuna

10/03/2024 at 06:14PM

40
#13 - Neix20 / @Neix20

10/07/2024 at 06:44AM

41
#14 - Melih Aktop / @mlhktp

11/02/2024 at 05:53PM

42
#15 - Abdelrahman Madkour / @a3madkour

04/09/2025 at 06:11PM

47
#16 - Haruaki Tomida / @haruyan-hopemucci

12/11/2024 at 03:49AM

47
#17 - lei / @oizhaolei

01/18/2025 at 03:00AM

49
#18 - Philippe Carphin / @PhilippeCarphin

10/15/2024 at 02:02AM

52
#19 - Michael Cuffaro / @maiku1008

11/23/2024 at 06:12PM

69
#20 - SRINIVASU SALADI / @SRINIVASUS22587

03/24/2025 at 04:10AM

80
#21 - Alex Mihov / @AlexMihov

10/25/2024 at 09:49AM

91
#22 - Adrien Beudin / @beudbeud

03/13/2025 at 04:11PM