2017-09-27 14:43:42 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
|
|
|
|
|
|
|
|
" Vim compiler file
|
|
|
|
" Compiler: Go
|
|
|
|
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
|
|
|
|
" Last Change: 2014 Aug 16
|
|
|
|
|
|
|
|
if exists('current_compiler')
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let current_compiler = 'go'
|
|
|
|
|
|
|
|
if exists(':CompilerSet') != 2
|
|
|
|
command -nargs=* CompilerSet setlocal <args>
|
|
|
|
endif
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo-=C
|
|
|
|
|
|
|
|
CompilerSet makeprg=go\ build
|
|
|
|
CompilerSet errorformat=
|
|
|
|
\%-G#\ %.%#,
|
|
|
|
\%A%f:%l:%c:\ %m,
|
|
|
|
\%A%f:%l:\ %m,
|
|
|
|
\%C%*\\s%m,
|
|
|
|
\%-G%.%#
|
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: sw=2 sts=2 et
|
|
|
|
|
|
|
|
endif
|
2015-12-06 05:51:45 -05:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
|
|
|
|
|
|
|
" Copyright 2013 The Go Authors. All rights reserved.
|
|
|
|
" Use of this source code is governed by a BSD-style
|
|
|
|
" license that can be found in the LICENSE file.
|
|
|
|
"
|
|
|
|
" compiler/go.vim: Vim compiler file for Go.
|
|
|
|
|
|
|
|
if exists("current_compiler")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let current_compiler = "go"
|
|
|
|
|
|
|
|
if exists(":CompilerSet") != 2
|
|
|
|
command -nargs=* CompilerSet setlocal <args>
|
|
|
|
endif
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo-=C
|
|
|
|
if filereadable("makefile") || filereadable("Makefile")
|
2016-06-26 12:03:28 -04:00
|
|
|
CompilerSet makeprg=make
|
2015-12-06 05:51:45 -05:00
|
|
|
else
|
2016-06-26 12:03:28 -04:00
|
|
|
CompilerSet makeprg=go\ build
|
2015-12-06 05:51:45 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
" Define the patterns that will be recognized by QuickFix when parsing the
|
|
|
|
" output of Go command that use this errorforamt (when called make, cexpr or
|
|
|
|
" lmake, lexpr). This is the global errorformat, however some command might
|
|
|
|
" use a different output, for those we define them directly and modify the
|
|
|
|
" errorformat ourselves. More information at:
|
|
|
|
" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#errorformat
|
|
|
|
CompilerSet errorformat =%-G#\ %.%# " Ignore lines beginning with '#' ('# command-line-arguments' line sometimes appears?)
|
|
|
|
CompilerSet errorformat+=%-G%.%#panic:\ %m " Ignore lines containing 'panic: message'
|
|
|
|
CompilerSet errorformat+=%Ecan\'t\ load\ package:\ %m " Start of multiline error string is 'can\'t load package'
|
|
|
|
CompilerSet errorformat+=%A%f:%l:%c:\ %m " Start of multiline unspecified string is 'filename:linenumber:columnnumber:'
|
|
|
|
CompilerSet errorformat+=%A%f:%l:\ %m " Start of multiline unspecified string is 'filename:linenumber:'
|
|
|
|
CompilerSet errorformat+=%C%*\\s%m " Continuation of multiline error message is indented
|
|
|
|
CompilerSet errorformat+=%-G%.%# " All lines not matching any of the above patterns are ignored
|
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2016-06-26 12:03:28 -04:00
|
|
|
" vim: sw=2 ts=2 et
|
2015-12-06 05:51:45 -05:00
|
|
|
|
|
|
|
endif
|