dongqiuwei8667
2016-06-12 01:17
浏览 133

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

I noticed that when I save a file and I have a syntax error in my code, the error quickfix window does not automatically appear. I recently rebuilt my system and simply copied over my .vim/ directory along with the same .vimrcfile. I've done this before and have never had any issues. However, if I manually enter :GoErrCheck or GoBuild, the window shows up. What gives?

Here is my .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    
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douping5015 2016-06-12 06:48
    已采纳

    Readme file in vim-go explains its usage with 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"
    

    In this issue

    One recommendation is to remove the lines

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

    and use

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

    instead

    已采纳该答案
    打赏 评论
  • duan205571 2016-06-12 04:29

    Assuming you are talking about errors shown by syntastic, this issue is probably similar to the one discussed here : 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']

    打赏 评论

相关推荐 更多相似问题