Skip to content

Add field tags for struct fields

Notifications You must be signed in to change notification settings

emacsorphanage/go-add-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-add-tags.el travis badge melpa badge melpa stable badge

Add field tags for struct fields. This package is inspired by GoAddTags of vim-go.

Screencast

Screencast of go-add-tags. Insert tags for struct fields with M-x go-add-tags

Installation

go-add-tags is available on MELPA and MELPA stable

You can install go-add-tags with the following command.

M-x package-install [RET] go-add-tags [RET]

Interfaces

go-add-tags

Insert tag at current line. You can input multiple tags at once by comma, like json,yaml. If region is enabled, then tags are inserted in lines in region. And current-prefix-key is specified, then you can choose field style function.

Customization

go-add-tags-style(Default: 'snake-case)

How to convert field in tag from field name.

  • snake-case
  • lower-camel-case
  • upper-camel-case
  • original

Sample Configuration

(custom-set-variables
 '(go-add-tags-style 'lower-camel-case))

(with-eval-after-load 'go-mode
  (define-key go-mode-map (kbd "C-c t") #'go-add-tags))