Windows上的CommandT安装问题

时间:2012-08-05 17:41:53

标签: vim

完成CommandT插件的所有安装步骤后,启动时出现错误command-t.vim could not load the C extension。 ComamndT故障排除部分提供了以下建议:

If a problem occurs the first thing you should do is inspect the output of:

  ruby extconf.rb
  make

During the installation, and:

  vim --version

And compare the compilation and linker flags that were passed to the
extension and to Vim itself when they were built. If the Ruby-related
flags or architecture flags are different then it is likely that something
has changed in your Ruby environment and the extension may not work until
you eliminate the discrepancy.

确实看起来确实存在差异。

make的输出表明cygwin的gcc正在使用ruby 1.8:

gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H    -g -O2    -std=c99 -Wall -Wextra -Wno-unused-parameter -c ext.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H    -g -O2    -std=c99 -Wall -Wextra -Wno-unused-parameter -c match.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H    -g -O2    -std=c99 -Wall -Wextra -Wno-unused-parameter -c matcher.c

gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -L/usr/lib -L.  -Wl,--enabl
e-auto-image-base,--enable-auto-import,--export-all   -lruby  -ldl -lcrypt

vim :version的输出包含此输出:

-DDYNAMIC_RUBY_VER=191 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby191.dll\"

故障排除指南建议使用Vim 7.2,Ruby 1.8.7-p299和DevKit 3.4.5r3-20091110的组合。然而,由于多种原因,这对我来说不是一个好的解决方案:

  1. 我正在使用Vim 7.3,并希望继续这样做。
  2. Ruby 1.9.3安装在我的系统上,我需要在我的PATH中用于其他项目。
  3. 那么有什么方法可以让这个工作,同时保留最新版本的ruby和最新版本的vim?

    更新

    根据AndrewMarshall的建议,我根据this tutorial安装了Ruby191和DevKit-4.5.0-20100819-1536-sfx.exe并通过该版本运行ruby extconf.rb。使用此输出成功执行make cmd:

    gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
    .9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H    -O2 -g -
    Wall -Wno-parentheses   -std=c99 -Wall -Wextra -Wno-unused-parameter -o ext.o -c
     ext.c
    gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
    .9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H    -O2 -g -
    Wall -Wno-parentheses   -std=c99 -Wall -Wextra -Wno-unused-parameter -o match.o
    -c match.c
    gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
    .9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H    -O2 -g -
    Wall -Wno-parentheses   -std=c99 -Wall -Wextra -Wno-unused-parameter -o matcher.
    o -c matcher.c
    gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -LC:/Ruby191/lib -L.  -Wl,-
    -enable-auto-image-base,--enable-auto-import   -lmsvcrt-ruby191  -lshell32 -lws2
    _32
    

    现在在vim中运行:CommandT,但是一旦我开始键入搜索文件,然后按回车键选择并打开它,我得到这个: Vim Crashing

2 个答案:

答案 0 :(得分:4)

不是真正的答案,但你可能想尝试ctrlp

  • vimscript写的(没有依赖,没有编译)
  • CommandT一样快(对我来说是主观的)
  • 可能有比CommandT更多的功能(CommandT 最近的文件吗?)

我还没有尝试过好的FuzzyFinder。似乎它已经有2年没有更新了,但它可能仍然有效。

答案 1 :(得分:1)

我在Windows 10上成功地在vim 8.0上安装了最新的command-t。当我正在处理它时,我发现了这个问题,所以我会发布我的解决方案,虽然它有点晚了。

vim 8.0的Ruby版本是Ruby 2.2。因此,请下载并安装Ruby 2.2Ruby Devkit(请记住为ruby dk.rb init执行ruby dk.rb installdevkit)。

然后我按照命令-t指令执行ruby extconf.conf,但它失败了 - 即使我安装了它,它输出You have to install development tools first.

我用谷歌搜索了这个问题,发现RubyInstaller wiki说我应该通过添加-rdevkit执行此命令,然后我就完成了。它在我执行ruby -rdevkit extconf.rb时成功,但在make时失败。所以我再次搜索并找到另一种编译方式:

rake make -rdevkit

它有效。这是我的截图:

enter image description here

相关问题