From: Andrew Gerrand Date: Wed, 13 Nov 2013 03:36:45 +0000 (+1100) Subject: [release-branch.go1.2] misc/vim: add a gofmt_command flag for :Fmt X-Git-Tag: go1.2rc4~8 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9af8f45258b7fc76c6ebc542b50554bc69f16865;p=gostls13.git [release-branch.go1.2] misc/vim: add a gofmt_command flag for :Fmt ««« CL 22940044 / 39c724dd7f25 misc/vim: add a gofmt_command flag for :Fmt R=dsymonds, dominik.honnef, n13m3y3r, rsc, kamil.kisiel CC=golang-dev https://golang.org/cl/22940044 »»» R=golang-dev CC=golang-dev https://golang.org/cl/25760043 --- diff --git a/misc/vim/ftplugin/go/fmt.vim b/misc/vim/ftplugin/go/fmt.vim index 5447d45748..5f7976f5f6 100644 --- a/misc/vim/ftplugin/go/fmt.vim +++ b/misc/vim/ftplugin/go/fmt.vim @@ -18,15 +18,21 @@ " " Flag to indicate whether to enable the commands listed above. " +" g:gofmt_command [default="gofmt"] +" +" Flag naming the gofmt executable to use. +" if exists("b:did_ftplugin_go_fmt") finish endif - if !exists("g:go_fmt_commands") let g:go_fmt_commands = 1 endif +if !exists("g:gofmt_command") + let g:gofmt_command = "gofmt" +endif if g:go_fmt_commands command! -buffer Fmt call s:GoFormat() @@ -34,7 +40,7 @@ endif function! s:GoFormat() let view = winsaveview() - silent %!gofmt + silent execute "%!" . g:gofmt_command if v:shell_error let errors = [] for line in getline(1, line('$'))