summaryrefslogtreecommitdiffstats
path: root/ftplugin/go
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2013-12-13 01:37:01 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2013-12-13 01:37:01 +0100
commitedd5ee63e66d9ef166034d9ac5bed132f501ecb9 (patch)
treefba293d90821eea5e067c7b5eea3526df0f26254 /ftplugin/go
parent8a255002df1f6d02ef7ca9503be1a7d7234acef8 (diff)
downloadvim-polyglot-1.4.2.tar.gz
vim-polyglot-1.4.2.zip
Updatev1.4.2
Diffstat (limited to 'ftplugin/go')
-rw-r--r--ftplugin/go/fmt.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/ftplugin/go/fmt.vim b/ftplugin/go/fmt.vim
index 5447d457..359545bd 100644
--- a/ftplugin/go/fmt.vim
+++ b/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('$'))
@@ -51,7 +57,7 @@ function! s:GoFormat()
endif
undo
if !empty(errors)
- call setloclist(0, errors, 'r')
+ call setqflist(errors, 'r')
endif
echohl Error | echomsg "Gofmt returned error" | echohl None
endif