2014-07-22 3 views
1

vim의 플러그인이 내 현재 go (golang) 파일을 정적으로 분석하고 오류를 포착하는 기능을 추가하려고했습니다."autocmd FileType go compiler go"가해야하는 것은 무엇입니까?

$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 FileType go compiler 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") 
} 

내가 autocmd FileType go compiler go을 할 예정이다 모르는 사촌 기대 해야할지 모르겠어. 나는 또한 '파티 흐/VIM-이동'플러그인을 설치하고 명령 :GoBuild을 수행하여이 시도

set nocompatible    " be iMproved, required 
filetype off     " required 

" set the runtime path to include Vundle and initialize 
set rtp+=~/.vim/bundle/Vundle.vim 
call vundle#begin() 
" alternatively, pass a path where Vundle should install plugins 
"call vundle#begin('~/some/path/here') 

" let Vundle manage Vundle, required 
Plugin 'gmarik/Vundle.vim' 

" Keep Plugin commands between vundle#begin/end. 
" plugin on GitHub repo 
Plugin 'tpope/vim-fugitive' 
" plugin from http://vim-scripts.org/vim/scripts.html 
Plugin 'L9' 
" Git plugin not hosted on GitHub 
Plugin 'git://git.wincent.com/command-t.git' 
" git repos on your local machine (i.e. when working on your own plugin) 
Plugin 'file:///home/gmarik/path/to/plugin' 
" The sparkup vim script is in a subdirectory of this repo called vim. 
" Pass the path to set the runtimepath properly. 
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} 
" Avoid a name conflict with L9 
Plugin 'user/L9', {'name': 'newL9'} 
Plugin 'commentary.vim' 
"Plugin 'fatih/vim-go' 
"Plugin 'Syntastic' 

" All of your Plugins must be added before the following line 
call vundle#end()   " required 
filetype plugin indent on " required 
""""------------------------------------ 
syntax on 
" filetype plugin on 
" filetype indent on 

autocmd FileType go compiler go 
" autocmd FileType go autocmd BufWritePre <buffer> Fmt 

:

이처럼 내 정력 파일이 모습입니다. 그런 종류의 작업이 아니라 현재 파일의 오류를 가리키는 대신 개발중인 다른 패키지의 다른 파일로 이동하여 오류가 있음을 분명히 알았지 만 그 파일을보고 싶지는 않습니다. 현재 파일의 오류. 이 작업을 수행하는 플러그인이 있습니까? 내 vim이 구원을 받거나이 일을 할 수있는 방법이 있습니까?

+0

autocmd는 사용자의 vimrc에 있어야합니다. 필자는 플러그인이 작동하지 않는 이유에 대해 언급하기에 충분하지 않습니다. 그러나 사용하지 않는 플러그인은 제거하는 것이 좋습니다. 예를 들어. '플러그인 '파일 : /// home/gmarik/path/to/plugin''은 실제 플러그인이 아닙니다 ... – FDinoff

답변

1
autocmd FileType go compiler go 

은 Vim에게 :make 일 때 사용할 컴파일러와 설정 만 알려줍니다. :compiler에 관해서는 :help :compiler이고, 링크는 :help write-compiler-plugin입니다.

Vim에서 코드에 오류를 표시하려면 :make 명령을 실행해야합니다.

~/.vimrc에 언급 된 Synthetic 플러그인은 이동 지원과 함께 제공되며 작성시 마술을합니다.

꽤 많은 go-related 플러그인을 설치하고 있으며, 아마도 당신의 인생을보다 복잡하게 만드는 것처럼 보입니다.

관련 문제