Reputation: 1027
Ruby is preinstalled on my Mac and so I wanted to have a look at it. First thing I noticed, is that irb prompts >> instead of irb(main):001:0>. I can't find anything on how to change this with Google because everyone is using irb(main):001:0> in their code ;-)
Can you help me out?
PS: It's not that I think Ruby is broken, but I want to look more nerdy while programming ;-)
Upvotes: 5
Views: 4438
Reputation: 12514
goto the location /home/leapfrog/.rvm/scripts
cd ~/.rvm/scripts
Open the file ‘irbrc.rb’, use superuser power to over-write the
$ sudo gedit irbrc.rb
Change the content of the hash '@prompt' to the following
@prompt = {
:PROMPT_I => "#{rvm_ruby_string} :%03n > ", # default prompt
:PROMPT_S => "#{rvm_ruby_string} :%03n%l> ", # known continuation
:PROMPT_C => "#{rvm_ruby_string} :%03n > ",
:PROMPT_N => "#{rvm_ruby_string} :%03n?> ", # unknown continuation
:RETURN => " => %s \n",
:AUTO_INDENT => true
}
Hope this help you :)
Upvotes: 0
Reputation: 71
What I do is make that into an alias in my .bashrc so I don't have to type it every time.
echo alias irb=\'irb --prompt inf-ruby\' >> ~/.bashrc
Hope this helps!
Upvotes: 0
Reputation: 117487
$ irb --help
Usage: irb.rb [options] [programfile] [arguments]
--prompt prompt-mode
--prompt-mode prompt-mode
Switch prompt mode. Pre-defined prompt modes are
`default', `simple', `xmp' and `inf-ruby'
$ irb --prompt inf-ruby
irb(main):001:0>
Upvotes: 13