Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fatih committed Jul 31, 2016
1 parent fd3e989 commit 394f9b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ function! go#util#AddTags(line1, line2, ...)
endif

let word = go#util#snippetcase(l:matched)

let tags = map(copy(l:keys), 'printf("%s:%s", v:val,"\"'. word .'\"")')

let updated_line = printf("%s `%s`", getline(line), join(tags, " "))

" finally, update the line inplace
call setline(line, updated_line)
endfor
endfunction
Expand Down
14 changes: 14 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,21 @@ CTRL-t
:GoImpl f *Foo io.Writer
:GoImpl T io.ReadWriteCloser
<
*:GoAddTags*
:[range]GoAddTags [key] [key1] ...

Adds field tags for the fields of a struct. If called inside a struct it
automatically add field tags with the `json` key and the value
automatically generated based on the field name. An error message is given
if it's called outside a struct definition.

If [range] is given, only the selected fields will be changed.

The default `json` can be changed by providing one or more [key]
arguments. An example of adding `xml` and `db` would be:
>
:GoAddTags xml db
<
*:GoAutoTypeInfoToggle*
:GoAutoTypeInfoToggle

Expand Down

0 comments on commit 394f9b1

Please sign in to comment.