summaryrefslogtreecommitdiff
path: root/misc/vim
diff options
context:
space:
mode:
authorDavid Bürgin <676c7473@gmail.com>2013-07-01 16:20:50 +1000
committerDavid Symonds <dsymonds@golang.org>2013-07-01 16:20:50 +1000
commitaec6b49aaebd7adc9ec8d11f3ffacdf041b0da2d (patch)
treeaf202318fb2f86102fb7ebe72fe27602fe93a710 /misc/vim
parent8192017e14a0902293717ef3c847672a9b9a0da4 (diff)
downloadgo-git-aec6b49aaebd7adc9ec8d11f3ffacdf041b0da2d.tar.gz
misc/vim: Add compiler plugin for Go
This change adds a basic compiler plugin for Go. The plugin integrates "go build" with Vim's ":make" command and the quickfix list. Fixes #5751. R=golang-dev, dsymonds, niklas.schnelle, 0xjnml CC=golang-dev https://golang.org/cl/10466043
Diffstat (limited to 'misc/vim')
-rw-r--r--misc/vim/compiler/go.vim30
-rw-r--r--misc/vim/readme.txt16
2 files changed, 46 insertions, 0 deletions
diff --git a/misc/vim/compiler/go.vim b/misc/vim/compiler/go.vim
new file mode 100644
index 0000000000..2c8cce4973
--- /dev/null
+++ b/misc/vim/compiler/go.vim
@@ -0,0 +1,30 @@
+" 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
+
+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:ts=4:sw=4:et
diff --git a/misc/vim/readme.txt b/misc/vim/readme.txt
index dca24ea1d0..a394cec5a9 100644
--- a/misc/vim/readme.txt
+++ b/misc/vim/readme.txt
@@ -14,6 +14,7 @@ To use all the Vim plugins, add these lines to your $HOME/.vimrc.
If you want to select fewer plugins, use the instructions in the rest of
this file.
+
Vim syntax highlighting
-----------------------
@@ -69,6 +70,21 @@ To install automatic indentation:
filetype indent on
+Vim compiler plugin
+-------------------
+
+To install the compiler plugin:
+
+ 1. Same as 1 above.
+ 2. Copy or link compiler/go.vim to the compiler directory underneath your vim
+ runtime directory (normally $HOME/.vim/compiler).
+ 3. Activate the compiler plugin with ":compiler go". To always enable the
+ compiler plugin in Go source files add an autocommand to your .vimrc file
+ (normally $HOME/.vimrc):
+
+ autocmd FileType go compiler go
+
+
Godoc plugin
------------