c - 与 MobaXterm 的合成插件

标签 c vim syntastic

我在使用 Syntastic 和 MobaXterm(基于 Cygwin)时遇到问题。我已经看过这篇文章:How to set up syntastic for vim?

我使用 Vundle 正确安装了 Syntastic(我知道是因为 :SyntasticCheck 不会返回任何错误)。

Syntastic 应该可以开箱即用,但它不会为简单损坏的 .c 文件显示任何内容

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

可能是路径问题? 在 vim 中运行 :echo syntastic#util#system('echo "$PATH"') 给出 /bin:/drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin:/drives/c/WINDOWS:/drives/c/WINDOWS/system32

gcc 可执行文件位于 /drives/c/Users/Justin/DOCUME~1/MobaXterm/slash/bin

运行的输出: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

随后运行 :mes 返回相同的输出。

测试文件缺少分号语法错误:

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

运行: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': []}

最佳答案

如果您不想阅读上面的评论,

我所要做的就是将以下内容添加到我的 vimrc 中:

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

关于c - 与 MobaXterm 的合成插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44097026/

相关文章:

c - 打印 rlim_t 类型的值的正确方法是什么?

c - 我创建了自己的 Linux shell,但在登录时得到 "mctrl: Permission denied"?

vim - 为什么 Syntastic 不捕获 JSON 错误?

javascript - vim 与 syntastic 和 eslint : show warnings

c++ - 任何好的 C++/C NNTP 库?

c++ - 字符串字母的排列 : How to remove repeated permutations?

vim - 在 Vim 中移动到段落/句子末尾的最有效方法是什么?

用于在 vim 中打开文件以便在 Xcode 的终端窗口中进行编辑的 C++ 代码

vim - 使用 Vim 脚本检查可选的 Vim 功能是否可用

ruby-on-rails-3 - Syntastic SASS Checker 中的 undefined variable 错误