无法获得"Syntastic"消息vim插件正常工作 [英] Can't get "Syntastic" vim plugin to work

查看:176
本文介绍了无法获得"Syntastic"消息vim插件正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在vim中安装了 Syntastic 插件.我无法正常工作.我试过:SyntasticEnable,但是没有运气.在我的vimrc中 SyntasticEnable python 也不起作用(实际上,它甚至都没有解析命令,当我尝试将其添加到.vimrc:Not an editor command: SyntasticEnable python时,会显示错误).

我怎么知道发生了什么事?当我从vim调用Syntastic时,它没有显示错误.第一个错误(我的.vimrc中的not and editor command)是否表明我没有意识到?

我的.vimrc中有:

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1

我在~/.vim/syntax_checkers中也有一个python.vim.我已经可以将 Pyflakes 用于python文件,它可以很棒,但我想在开发应用程序时在其他文件/扩展名中具有Syntastic功能.

解决方案

pyflakes是否在您的环境路径中?如果不是,则必须将其添加到路径中,或修改语法\ checkers \ python.vim并将完整路径添加到二进制文件中. 您必须修改两行:

if !(executable("pyflakes"))

还有

let makeprg = 'pyflakes %'


就我而言.我希望Syntastic在Windows计算机上使用PHP.因此,我不得不将php.vim中的这两行类似的内容修改为:

let s:php_executable = "C:\\Uniserver\\usr\\local\\php\\php.exe"
if !(executable(s:php_executable))

let makeprg = php_executable . " -l %"


如果您的路径包含空格,则必须在makeprg变量中将其用双引号引起来.另外,对于html.vim,必须将makeprg中的单引号替换为双引号,(您必须重新转义内部的所有内容).

let s:libfolder = "C:\\Program Files (x86)\\GnuWin32\\bin\\"
let s:tidyexe = s:libfolder . "tidy.exe"
let s:grepexe = s:libfolder . "grep.exe"
if !executable(s:tidyexe) || !executable(s:grepexe)

let makeprg="\"".s:tidyexe."\" -e % 2>&1 \\| \"".s:grepexe."\" -v \"\<table\> lacks \\\"summary\\\" attribute\"" 

I've installed Syntastic plugin in vim. I can't get it to work. I've tried :SyntasticEnable but no luck. SyntasticEnable python in my vimrc doesn't work either (in fact, it doesn't even parse the command, an error is shown when I try to add it to my .vimrc : Not an editor command: SyntasticEnable python).

How can I know what's going on? Syntastic isn't showing errors when I call it from vim. Does the first error (not and editor command in my .vimrc) indicates something I'm unaware of?

I have in my .vimrc:

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1

I have a python.vim in ~/.vim/syntax_checkers as well. I can already use Pyflakes for python files, it works GREAT but I would like to have Syntastic functionality in other files/extensions I need when developing applications.

解决方案

Is pyflakes on your environment path? If it is not, then you must add it to your path, or modify syntax\checkers\python.vim and add the full path to the binary. There are two lines you have to modify:

if !(executable("pyflakes"))

and also

let makeprg = 'pyflakes %'


In my case. I wanted Syntastic to work with PHP on my Windows machine. So I had to modify those two similar lines in php.vim to be:

let s:php_executable = "C:\\Uniserver\\usr\\local\\php\\php.exe"
if !(executable(s:php_executable))

and

let makeprg = php_executable . " -l %"


If your path contains spaces, you'll have to surround them in double quotes in the makeprg variable. Also with html.vim, the single quotes in makeprg must be replaced with double quotes, (you'll have to re-escape everything inside).

let s:libfolder = "C:\\Program Files (x86)\\GnuWin32\\bin\\"
let s:tidyexe = s:libfolder . "tidy.exe"
let s:grepexe = s:libfolder . "grep.exe"
if !executable(s:tidyexe) || !executable(s:grepexe)

and

let makeprg="\"".s:tidyexe."\" -e % 2>&1 \\| \"".s:grepexe."\" -v \"\<table\> lacks \\\"summary\\\" attribute\"" 

这篇关于无法获得"Syntastic"消息vim插件正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆