2

I just updated my ruby version and now when I run irb in command line, I get this weird:

1.9.2p290 :001 > 

every line. Before it was a simple >

How can I get it back again?

skolima
  • 31,963
  • 27
  • 115
  • 151
0xSina
  • 20,973
  • 34
  • 136
  • 253

2 Answers2

2

You can edit your ~/.irbrc file to change the prompt (command line prefix). See this answer for an example. You could put this in there to start:

IRB.conf[:PROMPT][:CUSTOM] = {:PROMPT_I => ">> "}
IRB.conf[:PROMPT_MODE] = :CUSTOM
IRB.conf[:AUTO_INDENT] = true

.irbrc is a Ruby script that irb runs when it starts up that lets you configure your prompt.

Community
  • 1
  • 1
rkb
  • 3,442
  • 19
  • 25
  • Note that this doesn't work in 2.3. `NoMethodError: undefined method 'write' for nil:NilClass`. See the answer by @user1179942 – Eric Haynes Nov 12 '16 at 15:41
2

From this article, in your user dir ~/, create the .irbrc file with following:

IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode
  :PROMPT_I => ">",          # normal prompt
  :PROMPT_S => nil,          # prompt for continuated strings
  :PROMPT_C => nil,          # prompt for continuated statement
  :RETURN => "=> %s\n"       # format to return value
}
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
user1179942
  • 381
  • 1
  • 4
  • 9