vim-go/synstastic 保存时不自动显示错误

vim-go/synstastic Errors not automatically displaying on save

我注意到当我保存文件并且我的代码中有语法错误时,错误 quickfix window 不会自动出现。我最近重建了我的系统并简单地复制了我的 .vim/ 目录以及相同的 .vimrc 文件。我以前做过这个,从来没有遇到过任何问题。但是,如果我手动输入 :GoErrCheckGoBuild,则会显示 window。给出了什么?

这是我的 .vimrc

execute pathogen#infect()                                                                                                                                                                                                                     
syntax on                                                                                                                                                                                                                                     
filetype plugin indent on                                                                                                                                                                                                                     

set nu                                                                                                                                                                                                                                        
set completeopt-=preview                                                                                                                                                                                                                      
set encoding=utf-8              " Set default encoding to UTF-8                                                                                                                                                                               
set autoread                                                                                                                                                                                                                                  
set laststatus=2                                                                                                                                                                                                                              
set noswapfile               " Don't use swapfile                                                                                                                                                                                             
set nobackup " Don't create annoying backup files                                                                                                                                                                                             
"                                                                                                                                                                                                                                             
nmap <Leader>t :TagbarToggle<CR>                                                                                                                                                                                                              

autocmd FileType qf wincmd J                                                                                                                                                                                                                  
"CtrlP Settings                                                                                                                                                                                                                               
let g:ctrlp_show_hidden = 1                                                                                                                                                                                                                   
let g:neocomplete#enable_at_startup = 1                                                                                                                                                                                                       

let g:go_highlight_functions = 1                                                                                                                                                                                                              
let g:go_highlight_methods = 1                                                                                                                                                                                                                
let g:go_highlight_fields = 1                                                                                                                                                                                                                 
let g:go_highlight_structs = 1                                                                                                                                                                                                                
let g:go_highlight_interfaces = 1                                                                                                                                                                                                             
let g:go_highlight_operators = 1                                                                                                                                                                                                              
let g:go_highlight_build_constraints = 1                                                                                                                                                                                                      
let g:molokai_original = 1                                                                                                                                                                                                                    


let mapleader=","                                                                                                                                                                                                              
colorscheme molokai    

假设您正在谈论 syntastic 显示的错误,这个问题可能与此处讨论的问题类似:vim-go with syntastic

Synastic doesn't check Go files on save by default (anymore). Add this to your .vimrc to make that happen:

let g:syntastic_go_checkers = ['go']

vim-go 中的自述文件解释了其用法 syantastic

Sometimes when using both vim-go and syntastic Vim will start lagging while saving and opening files. The following fixes this:

let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }

Another issue with vim-go and syntastic is that the location list window that contains the output of commands such as :GoBuild and :GoTest might not appear. To resolve this:

let g:go_list_type = "quickfix"

this issue

一个建议是删除行

let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': 

并使用

let g:syntastic_go_checkers = ['govet', 'errcheck', 'go']

改为