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

发布于 2024-09-11 03:18:20 字数 1094 浏览 8 评论 0原文

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌逼全场 2024-09-18 03:18:20

pyflakes 是否在您的环境路径上?如果不是,那么您必须将其添加到您的路径中,或者修改syntax\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\"" 

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\"" 
迷荒 2024-09-18 03:18:20

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

:echo $PATH

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

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

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

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

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

:echo $PATH

If not, try putting this in your .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.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文