首页 > 解决方案 > Command-T 不会为 Vim 编译

问题描述

我正在尝试为 Vim 安装 Command-T,但到目前为止没有成功。

我使用 brew 重新安装了 vim,vim 的 ruby​​ 版本是 2.5.1

我使用 RVM 安装了 ruby​​ 2.5.1,我运行了 ruby​​ ruby​​ extconf.rb,我得到了这个输出

checking for float.h... yes
checking for ruby.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
checking for ruby/st.h... yes
checking for st.h... yes
checking for pthread_create() in -lpthread... yes
creating Makefile

然后我运行 make 并得到它:

compiling ext.c
compiling heap.c
compiling match.c
compiling matcher.c
compiling watchman.c
linking shared-object ext.bundle

但是当我尝试在我的 vim 上使用它时,我收到以下消息:

command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.5.1-p57
For more information type:    :help command-t

如果我使用 ruby​​ 版本 2.5.0 编译,消息说我得到了错误的 ruby​​ 版本。

我不知道我还能做什么,请帮助我

标签: vim

解决方案


问题是您必须使用与编译vim相同的ruby​​ 来编译command-t C扩展。

您提到您正在使用RVM以及使用ruby​​ 2.5.1-p57编译的vim 。您需要选择完全相同的ruby​​ 。如果您使用RVM的 ruby​​ 2.5.1-p57编译(在您的情况下使用brew安装)vim,则运行命令:

$ rvm use 2.5.1-p57

然后重新编译command-t,确保ruby -v返回2.5.1-p57:

$ ruby -v

$ ruby extconf.rb

$ make

如果这没有帮助,可能是您使用系统范围的 ruby​​ 安装了它,它具有相同的 2.5.1 版本。这可以解决问题:

$ rvm use system

$ ruby extconf.rb

$ make

使用与编译vim相同版本的ruby​​ 编译command-t的想法。

在更糟糕的情况下,您可以重新安装 vim。

您也可以参考command-t 文档


推荐阅读