Ruby : RVM : change prompt of irb

IN Linux ( Ubuntu 14.04)

You can change the irritating prompt of the irb console just by following some simple steps

Open your terminal

goto the location /home/john/.rvm/scripts

$ cd ~/.rvm/scripts

Open the file ‘irbrc.rb’, use superuser power to over-write the

$ sudo gedit irbrc.rb

You can see a portion of code like this. Replace the former with latter codes

# Set up the prompt to be RVM specific.
#@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
#}

@prompt = {
 :PROMPT_I => "ROR: %03n > ", # default prompt
 :PROMPT_S => "%03n%l> ", # known continuation
 :PROMPT_C => "%03n > ",
 :PROMPT_N => "%03n?> ", # unknown continuation
 :RETURN => " O/P => %s \n",
 :AUTO_INDENT => true
}

Just save the file and restart the irb console

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s