fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16k stars 1.45k forks source link

Feature Request: GoExport #3509

Closed sding3 closed 1 year ago

sding3 commented 1 year ago

Add a new command GoExport which would export the current symbol if it's unexported currently, or unexport if it's exported currently.

Yes, this is possible with GoRename today, but it's a bit cumbersome.

bhcleek commented 1 year ago

There's no need for a :GoExport; you can use the tab key with :GoRename to cycle between PascalCase and camelCase forms.

bhcleek commented 1 year ago

@sding3 you may also be interested in changing your g:go_gorename_prefill thusly: let g:go_gorename_prefill = 'expand("<cword>") =~# "^[A-Z]" ? go#util#camelcase(expand("<cword>")) : go#util#pascalcase(expand("<cword>"))'

If you do that, then the other case will be the default value when :GoRename is not given an argument, and you could easily enter: :GoRename<Enter><Enter> to do the export. In such a case, the (go-rename) mapping would also benefit.

sding3 commented 1 year ago

@bhcleek - thank you, that's exactly what I need!