The ability for IRB to automate code 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 no code auto-completion, which is a little inconvenient. In fact, plus is also very simple, is in IRB add 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?

The simplest way to do this once and for all is to add the code that the IRB runtime needs to execute in the ~/.IRBRC. You have to ask me how I know. irbrc file path you can see through irb.rc_file. There is also a more advanced auto-completion function on the Internet. This includes adding 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:

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 try it yourself.

The ability for IRB to automate code 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.