简体   繁体   English

使用MobaXterm的Syntastic插件

[英]Syntastic Plugin with MobaXterm

I'm having troubles using Syntastic with MobaXterm (which was based off of Cygwin). 使用Syntastic和MobaXterm(基于Cygwin)时遇到了麻烦。 I already looked at this post: How to set up syntastic for vim? 我已经看过这篇文章: 如何为vim设置syntastic?

I used Vundle to properly install Syntastic (I know because :SyntasticCheck doesn't return any errors). 我使用Vundle正确安装Syntastic(我知道,因为:SyntasticCheck不会返回任何错误)。

Syntastic is supposedly supposed to work out of the box but it doesn't display anything for a simple broken .c file 据说Syntastic可以开箱即用,但对于简单的损坏的.c文件,它不显示任何内容

Here is the relevant portion of my vimrc: 这是我的vimrc的相关部分:

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_enable_signs=1
let g:syntastic_check_on_wq = 0

It might be a path problem? 可能是路径问题? Running :echo syntastic#util#system('echo "$PATH"') in vim gives /bin:/drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin:/drives/c/WINDOWS:/drives/c/WINDOWS/system32 在vim中运行:echo syntastic#util#system('echo "$PATH"')得到/bin:/drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin:/drives/c/WINDOWS:/drives/c/WINDOWS/system32

And the gcc executable is in /drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin 并且gcc可执行文件位于/drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin

Output of running :SyntasticInfo 正在运行的输出:SyntasticInfo

Syntastic version: 3.8.0-55 (Vim 703, CYGWIN_NT-10.0-WOW)
Info for filetype: c
Global mode: active
Filetype c is active
The current file will be checked automatically
Available checkers: clang_check gcc make
Currently enabled checker: gcc

Running :mes afterwards returns the same output. 之后运行:mes返回相同的输出。

Test file with a missing semicolon syntax error: 测试文件缺少分号语法错误:

int main(int argc, const char *argv[]) {
    asdf
    return 0;
}

Output after running :let g:syntastic_debug = 3 and :mes 运行:let g:syntastic_debug = 3:mes

"t.c" 4L, 66C
syntastic: 12.829662: g:syntastic_version = '3.8.0-55 (Vim 703, CYGWIN_NT-10.0-WOW)'
syntastic: 12.829837: &shell = '/bin/bash.exe', &shellcmdflag = '-c',     &shellpipe = '| tee', &shellquote = '', &shellredir = '>', &shelltemp = 1, &
shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 12.830506: UpdateErrors: default checkers
syntastic: 12.831086: CacheErrors: default checkers
syntastic: 12.832006: g:syntastic_aggregate_errors = 0
syntastic: 12.832240: getcwd() = '/home/mobaxterm'
syntastic: 12.832960: CacheErrors: Invoking checker: c/gcc
syntastic: 12.834858: SyntasticMake: called with options: {'postprocess': [], 'errorformat': '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,%-G%f:%l: %#error: %#for each function it appears%.%#,%-GIn file included%.%#,%-G %#from %f:%l\,,%f:%l:%c: %trror: %m, %f:%l:%c: %tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,%f:%l: %m', 'makeprg': 'gcc -x c -fsyntax-only -std=gnu99 -I. -I.. -Iinclude -Iincludes -I../include -I../includes   t.c'}
syntastic: 12.930358: system: command run in 0.095090s
syntastic: 12.930519: checker output: ['']
syntastic: 12.930918: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 12.931157: getLocList: checker c/gcc returned 1
syntastic: 12.931302: c/gcc raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 12.931547: quiet_messages filter: {}
syntastic: 12.931696: getLocList: checker c/gcc run in 0.098600s
syntastic: 12.932000: aggregated: {'_sorted': 0, '_name': '', '_owner':  1, '_columns': 1, '_rawLoclist': []}

If you don't want to read through the comments above, 如果您不想通读以上评论,

All I had to do was add the following to my vimrc: 我要做的就是将以下内容添加到我的vimrc中:

let &shellpipe = '2>&1| tee'
let &shellredir = '>%s 2>&1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM