summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:51:45 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:51:45 +0100
commitba7a783c7f3d3c923ef151e4d3e99e087831ef69 (patch)
tree4f6beff52e14a5415c5e036d6478eb092c940952
parentf58692a6410c6ce13de0eb6f03ab7e918ed7d1e5 (diff)
downloadvim-polyglot-ba7a783c7f3d3c923ef151e4d3e99e087831ef69.tar.gz
vim-polyglot-ba7a783c7f3d3c923ef151e4d3e99e087831ef69.zip
Pack compiler configuration with go, closes #84
Diffstat (limited to '')
-rw-r--r--README.md2
-rwxr-xr-xbuild2
-rw-r--r--compiler/go.vim45
3 files changed, 47 insertions, 2 deletions
diff --git a/README.md b/README.md
index eb2fa733..2cfca330 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent, ftdetect)
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent, ftdetect)
-- [go](https://github.com/fatih/vim-go) (syntax, indent, ftdetect)
+- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent, ftdetect)
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
- [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin, ftdetect)
diff --git a/build b/build
index 2ed8c2a8..589a04b4 100755
--- a/build
+++ b/build
@@ -3,7 +3,7 @@
set -E
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
-DIRS_BASIC="syntax indent ftdetect after/syntax after/indent after/ftdetect"
+DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
OUTPUT=""
diff --git a/compiler/go.vim b/compiler/go.vim
new file mode 100644
index 00000000..59fca658
--- /dev/null
+++ b/compiler/go.vim
@@ -0,0 +1,45 @@
+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")
+ CompilerSet makeprg=make
+else
+ CompilerSet makeprg=go\ build
+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
+
+" vim:ts=4:sw=4:et
+
+endif