diff --git a/autoload/go/fmt.vim b/autoload/go/fmt.vim index 4d03daf2c0..411e1a283f 100644 --- a/autoload/go/fmt.vim +++ b/autoload/go/fmt.vim @@ -129,17 +129,19 @@ function! go#fmt#update_file(source, target) " the title information was introduced with 7.4-2200 " https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640 - if !has('patch-7.4-2200') - return - endif - - " clean up previous list - let l:listtype = go#list#Type("GoFmt") - if l:listtype == "quickfix" - let l:list_title = getqflist({'title': 1}) + if has('patch-7.4-2200') + " clean up previous list + let l:listtype = go#list#Type("GoFmt") + if l:listtype == "quickfix" + let l:list_title = getqflist({'title': 1}) + else + let l:list_title = getloclist(0, {'title': 1}) + endif else - let l:list_title = getloclist(0, {'title': 1}) + " can't check the title, so assume that the list was for go fmt. + let l:list_title = {'title': 'Format'} endif + if has_key(l:list_title, "title") && l:list_title['title'] == "Format" call go#list#Clean(l:listtype) call go#list#Window(l:listtype)