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 10 remaining solutions by signing in and submitting your own entry
#11 Alex Mihov / @AlexMihov - Score: 80 - 10/25/24 @ 09:49
<Down><Down>$v%yGo<fd-6b>p<Down>vi{:s/db:<BS><BS><BS>.*db://<CR>24ggddf`d$vi{:s/`/<BS><BS>`/<BS>\n/, <CR><Up><Up>J<Del>A,<fd-6b>J<fd-6b>A<Left><Left><BS><Right><BS><fd-6b>:wq<CR>

0 comments


Created by: @__ngtrongkha

11 active golfers, 27 entries

Leaderboard (lowest score wins):
33
#1 - Peppa Pig / @PeppaPi95550250

10/04/2024 at 01:04AM

33
#2 - JMTed / @JMTed

10/04/2024 at 08:31AM

33
#3 - rasputins / @rasputins

10/16/2024 at 07:37PM

33
#4 - John Braxler / @braxler

10/17/2024 at 07:45PM

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

10/20/2024 at 06:12AM

35
#6 - Roger Stoltz / @rogsto1

10/22/2024 at 04:13PM

40
#7 - Pablo Acuna / @pacuna

10/03/2024 at 06:14PM

40
#8 - Neix20 / @Neix20

10/07/2024 at 06:44AM

41
#9 - Melih Aktop / @mlhktp

11/02/2024 at 05:53PM

49
#10 - Philippe Carphin / @PhilippeCarphin

10/15/2024 at 02:02AM

80
#11 - Alex Mihov / @AlexMihov

10/25/2024 at 09:49AM