vim-go/synstatic 错误不会在保存时自动显示

标签 vim go syntastic

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

这是我的.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    

最佳答案

自述文件在 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']

代替

关于vim-go/synstatic 错误不会在保存时自动显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37769882/

相关文章:

vim - 在 WSL@Windows 10 上使用 C-v 在 Vim 中不工作的可视 block 模式

regex - 我如何在 vim 中翻译正则表达式以与 sed 一起工作?

vim - 如何检查我是否在 vimrc 中以只读模式 (-R) 运行

shell - vim:运行 shell(不是 make,不是 perl,不是...),解析输出,跳转到错误位置

mysql - Golang 加入数组接口(interface)

vim - 禁用 pep8 检查 python 文件的语法

vim - 在 VIM 中使用 :q, :q! 或 :wq! 时完全退出 Syntastic 创建的位置列表 (lcl) 以及主缓冲区

c++ - 综合cpp : fatal error "QApplication: no such file or directory"

go - 安装 Golang 时遇到的问题

go - 如何在 Visual Studio Code 中使用 Cgo 调试 Go