From c11975bc1fd6e2c28998b4b5c303ff8cf543515e Mon Sep 17 00:00:00 2001 From: Caleb Spare Date: Thu, 11 Feb 2016 00:31:30 -0800 Subject: [PATCH] Remember fmt failure on a per-buffer basis Fixes #720 --- autoload/go/fmt.vim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/autoload/go/fmt.vim b/autoload/go/fmt.vim index 9ef9a2ebe2..7270a108c9 100644 --- a/autoload/go/fmt.vim +++ b/autoload/go/fmt.vim @@ -43,8 +43,6 @@ if !exists("g:go_fmt_experimental") let g:go_fmt_experimental = 0 endif -let s:got_fmt_error = 0 - " we have those problems : " http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree " http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1 @@ -120,12 +118,12 @@ function! go#fmt#Format(withGoimport) let &syntax = &syntax " clean up previous location list, but only if it's due fmt - if s:got_fmt_error - let s:got_fmt_error = 0 + if exists('b:got_fmt_error') && b:got_fmt_error + let b:got_fmt_error = 0 call go#list#Clean() call go#list#Window() endif - elseif g:go_fmt_fail_silently == 0 + elseif g:go_fmt_fail_silently == 0 let splitted = split(out, '\n') "otherwise get the errors and put them to location list let errors = [] @@ -146,7 +144,7 @@ function! go#fmt#Format(withGoimport) echohl Error | echomsg "Gofmt returned error" | echohl None endif - let s:got_fmt_error = 1 + let b:got_fmt_error = 1 call go#list#Window(len(errors)) " We didn't use the temp file, so clean up