mirror of
https://github.com/golang/go.git
synced 2025-05-23 00:11:26 +00:00
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
This commit is contained in:
parent
8192017e14
commit
aec6b49aae
30
misc/vim/compiler/go.vim
Normal file
30
misc/vim/compiler/go.vim
Normal file
@ -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
|
@ -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
|
||||
------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user