The ability of the IRB to implement the code's own self-completion under Linux

Source: Internet
Author: User

I don't know if IRB has this feature on other systems, but the IRB ruby2.1.2 on Ubuntu defaults to the fact that there is no code to take the initiative to fully function, which is somewhat inconvenient. Actually Plus is also very easy, is in IRB loaded a module: Require ' Irb/completion ', but we're not going to have to hit a line of code every time, where's kiss and dry?

A simple, once and for all method is to add the code required to execute the IRB in ~/.IRBRC. You have to ask me how I know. irbrc file path that you can see through irb.rc_file. Online and more advanced self-complement function, Include add syntax highlighting, and so on. The author's method is to download and install the wirble gem:sudo gem install wirble, and then add the following code to the. irbrc file, for example:

Require "RubyGems" require "wirble" wirble.initwirble.colorizeirb.conf[:auto_indent] = trueirb.conf[:use_readline] = Trueirb.conf[:load_modules] = [] unless IRB.conf.key? (: load_modules) unless irb.conf[:load_modules].include? (' irb/completion ')    Irb.conf[:load_modules] << ' irb/completion ' end

Interested children's shoes can be tried by themselves oh.

The ability of the IRB to implement the code's own self-completion under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.