summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-11-13 14:36:45 +1100
committerAndrew Gerrand <adg@golang.org>2013-11-13 14:36:45 +1100
commit4b338c9414714c62d85ad2897236867097aefa6d (patch)
treed3a70d9fbf37827cabff4e22142444f74c12bd58
parentb5982825bed67aaa1bf01f765fcc4448ca05858b (diff)
downloadgo-4b338c9414714c62d85ad2897236867097aefa6d.tar.gz
[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://codereview.appspot.com/22940044 Committer: David Symonds <dsymonds@golang.org> ??? R=golang-dev CC=golang-dev https://codereview.appspot.com/25760043
-rw-r--r--misc/vim/ftplugin/go/fmt.vim10
1 files changed, 8 insertions, 2 deletions
diff --git a/misc/vim/ftplugin/go/fmt.vim b/misc/vim/ftplugin/go/fmt.vim
index 5447d4574..5f7976f5f 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('$'))