:GoAddTags
command for Go
When you have struct
type Foo struct {
Name string
Value int
}
Add json/db tags to the struct under the cursor
:GoAddTags json db
type Foo struct {
Name string `json:"name" db:"name"`
Age int `json:"age" db:"age"`
}
If you prefer to use camelCase
instead of snake_case
for the values, you can use the g:go_addtags_transform
variable to define a different transformation rule. The following example uses the camelCase
transformation rule.
let g:go_addtags_transform = 'camelcase'
For vim-plug plugin manager:
Plug 'mattn/vim-goaddtags'
MIT
Yasuhiro Matsumoto (a.k.a. mattn)