简体   繁体   English

Vim的Ruby选项未启用

[英]Vim's Ruby option is not enabled

I just started learning Ruby and I ran this command: 我刚开始学习Ruby,并运行了以下命令:

vim --version

The output looks like this (look at the yellow circle): 输出如下所示(请看黄色圆圈):

在此处输入图片说明

Which means that my Vim does not include the 'ruby' function. 这意味着我的Vim不包含“红宝石”功能。 But it seems my Vim supports Ruby fairly well: 但是似乎我的Vim很好地支持Ruby:

在此处输入图片说明

q1: Is there any problem with my Ruby programming with the -ruby ? q1:我的-ruby Ruby编程是否有问题?

q2: How can I enable Ruby function in Vim? q2:如何在Vim中启用Ruby功能?

The functionality on the second screenshot is given by installing the vim-ruby plugin. 通过安装vim-ruby插件可以提供第二个屏幕截图上的功能。

The internal Ruby support is to allow people to write plugins and scripts for Vim using Ruby and it's not strictly necessary for what you seem to want to accomplish. Ruby的内部支持是允许人们使用Ruby编写Vim的插件和脚本,对于您似乎想要完成的工作,这并非绝对必要。

If you REALLY want to add Ruby support, you can always build Vim from source (or get a package with it already built). 如果您真的想添加Ruby支持,则始终可以从源代码构建Vim(或获取已构建的软件包)。 I suggest you to look into Vim's homepage for more info on this matter. 建议您查看Vim的主页 ,以获取有关此问题的更多信息。

The difference you are missing is between using Vim to program in a language such as Ruby, and using a given language to program Vim . 您缺少的区别在于使用Vim以Ruby之类的语言进行编程 ,以及使用给定语言的Vim进行编程之间

Writing Ruby code using Vim is enabled by Vim's native syntax files, as well as various third-party plugins available for Vim. Vim的本机语法文件以及可用于Vim的各种第三方插件支持使用Vim编写Ruby代码。 This is the case for many, many languages, not only those mentioned in the :version screen (Perl, Python, and Ruby). 许多语言都是这种情况,不仅是:version屏幕中提到的那些语言(Perl,Python和Ruby)。 You can use Vim to write code in C, Scala, PHP, Javascript, and many other languages, with support for syntax highlighting, smart indenting, and so on. 您可以使用Vim以C,Scala,PHP,Javascript和许多其他语言编写代码,并支持语法突出显示,智能缩进等。

Writing Vim functions and plugins can only be done in a small set of languages. 编写Vim函数和插件只能用少量语言完成。 Natively, Vim code is always written in its own language, Vimscript. 在本地,Vim代码始终以其自己的语言Vimscript编写。 However, Vimscript is notoriously difficult to deal with, and most people will not already know it. 但是,众所周知,Vimscript很难处理,大多数人还不知道。 So Vim also has the ability to use plugins written in other languages, such as Python or Ruby. 因此,Vim还可以使用以其他语言编写的插件,例如Python或Ruby。 This enables people to use a more familiar language for plugin development. 这使人们能够使用更熟悉的语言进行插件开发。

However, using those languages requires binding to an interpreter for the language, and this must be decided at the time Vim is compiled. 但是,使用这些语言需要绑定到该语言的解释器,并且必须在编译Vim时确定。 The :version screen is telling you that for your installation of Vim, the Ruby support was not enabled, so you can not write plugins using Ruby, nor can you use any available plugins which were written in Ruby. :version屏幕告诉您,对于Vim的安装,未启用Ruby支持,因此您不能使用Ruby编写插件,也不能使用任何用Ruby编写的可用插件。

Notice that +python is present, so you can use Python plugins (but -python3 is there too, meaning that you do not have Python 3.x support built in). 请注意,存在+python ,因此您可以使用Python插件(但也有-python3 ,这意味着您没有内置的Python 3.x支持)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM