Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim “什么是”呢;autocmd文件类型go编译器go“;该怎么办?_Vim_Go - Fatal编程技术网

Vim “什么是”呢;autocmd文件类型go编译器go“;该怎么办?

Vim “什么是”呢;autocmd文件类型go编译器go“;该怎么办?,vim,go,Vim,Go,我试图添加vim中的插件静态分析我当前的go(golang)文件并捕获错误的功能 我尝试的是执行$GOROOT/misc/vim中readme.txt文件中的说明。在那里,它提出了以下建议: Vim compiler plugin ------------------- To install the compiler plugin: 1. Same as 1 above. 2. Copy or link compiler/go.vim to the compiler director

我试图添加vim中的插件静态分析我当前的go(golang)文件并捕获错误的功能

我尝试的是执行
$GOROOT/misc/vim
中readme.txt文件中的说明。在那里,它提出了以下建议:

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
------------
他们说的我都做了,但是:

autocmd文件类型go编译器go

保存文件时不执行任何操作。它应该做什么?我的代码中显然存在错误:

package main

import "fmt"

//This is my first go program!
//cool hu? Hope I can render this.
func main(){
jhjkahsdjkh //<-----------------ERROR HERE
        fmt.Print("Hello World\n")
}
我还通过安装'fatih/vim go'插件并执行命令
:GoBuild
尝试了这一点。这样做是可行的,但是我没有在中指出当前文件中的错误,而是转到了其他包中的其他文件,这些文件正在开发中,显然存在错误,但我不想看到这些错误,我只想看到当前文件中的错误。有这样的插件吗?有没有办法让我的vim在保存或其他情况下执行此操作

autocmd FileType go compiler go
仅告诉Vim在执行
:make
时要使用的编译器和设置。您可以阅读
:help:compiler
中的
:compiler
以及链接的
:help write compiler plugin

如果希望Vim显示代码中的错误,则需要发出
:make
命令

请注意,Syntastic插件(在您的
~/.vimrc
中有注释)提供了Go支持,并在编写时发挥了神奇的作用


看起来您正在安装大量与go相关的插件,并且可能会使您的生活变得更加复杂。

autocmd应该安装在您的vimrc中。我对这些插件了解不够,无法解释它们为什么不起作用。但是我建议删除你不使用的插件。比如说<代码>插件'file:///home/gmarik/path/to/plugin“不是真正的插件。。。
autocmd FileType go compiler go