无法获得“Syntastic”vim插件工作

时间:2022-11-08 17:26:18

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).

我在vim中安装了Syntastic插件。我无法让它发挥作用。我试过了:SyntasticEnable但没有运气。我的vimrc中的SyntasticEnable python也不起作用(事实上,它甚至不解析命令,当我尝试将它添加到我的.vimrc时显示错误:不是编辑器命令: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?

我怎么知道发生了什么?当我从vim调用它时,Syntastic没有显示错误。第一个错误(不是我的.vimrc中的编辑器命令)是否表示我不知道的事情?

I have in my .vimrc:

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

我在〜/ .vim / syntax_checkers中也有一个python.vim。我已经可以将pyflakes用于python文件,它的工作原理很棒,但我想在开发应用程序时需要其他文件/扩展中的Syntastic功能。

2 个解决方案

#1


5  

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:

你的环境路径上有pyflakes吗?如果不是,则必须将其添加到路径中,或修改syntax \ checkers \ python.vim并添加二进制文件的完整路径。您需要修改两行:

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:

在我的情况下。我希望Syntastic能够在我的Windows机器上使用PHP。所以我不得不在php.vim中修改这两个相似的行:

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).

如果您的路径包含空格,则必须在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)

and

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

#2


1  

Have you tried to make sure Vim has the right value set for $PATH?

您是否尝试确保Vim为$ PATH设置了正确的值?

:echo $PATH

If not, try putting this in your .vimrc:

如果没有,请尝试将其放在.vimrc中:

let $PATH=substitute(system("echo \$PATH"), "\r\*\n", "", "g")

Then shutdown and restart vim. If it works, you won't have to manually update the plugin's source files to manually include the path to the executables.

然后关闭并重新启动vim。如果它工作,您将不必手动更新插件的源文件以手动包含可执行文件的路径。

(found this via: https://superuser.com/questions/380535/getting-man-path-through-vim )

(通过以下网址找到:https://superuser.com/questions/380535/getting-man-path-through-vim)

#1


5  

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:

你的环境路径上有pyflakes吗?如果不是,则必须将其添加到路径中,或修改syntax \ checkers \ python.vim并添加二进制文件的完整路径。您需要修改两行:

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:

在我的情况下。我希望Syntastic能够在我的Windows机器上使用PHP。所以我不得不在php.vim中修改这两个相似的行:

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).

如果您的路径包含空格,则必须在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)

and

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

#2


1  

Have you tried to make sure Vim has the right value set for $PATH?

您是否尝试确保Vim为$ PATH设置了正确的值?

:echo $PATH

If not, try putting this in your .vimrc:

如果没有,请尝试将其放在.vimrc中:

let $PATH=substitute(system("echo \$PATH"), "\r\*\n", "", "g")

Then shutdown and restart vim. If it works, you won't have to manually update the plugin's source files to manually include the path to the executables.

然后关闭并重新启动vim。如果它工作,您将不必手动更新插件的源文件以手动包含可执行文件的路径。

(found this via: https://superuser.com/questions/380535/getting-man-path-through-vim )

(通过以下网址找到:https://superuser.com/questions/380535/getting-man-path-through-vim)