diff --git a/ChangeLog b/ChangeLog index a04aa0066a..635fc7c12d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 5 08:03:00 2013 Zachary Scott + + * lib/irb.rb, lib/irb/ext/save-history.rb: Add documentation on how to + enabled irb history [ruby-core:51347] [Bug #7679] + Tue Feb 5 07:35:00 2013 Zachary Scott * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable diff --git a/lib/irb.rb b/lib/irb.rb index 755fb050ae..7f3de5dffe 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -117,6 +117,18 @@ STDOUT.sync = true # # require 'irb/completion' # +# === History +# +# By default, irb disables history and will not store any commands you used. +# +# If you want to enable history, add the following to your +.irbrc+: +# +# IRB.conf[:SAVE_HISTORY] = 1000 +# +# This will now store the last 1000 commands in ~/.irb_history. +# +# See IRB::Context#save_history= for more information. +# # == Customizing the IRB Prompt # # In order to customize the prompt, you can change the following Hash: diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index d61fec9ff7..7b3fcbbeec 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -29,6 +29,13 @@ module IRB # Sets IRB.conf[:SAVE_HISTORY] to the given +val+ and calls # #init_save_history with this context. + # + # Will store the number of +val+ entries of history in the #history_file + # + # Add the following to your +.irbrc+ to change the number of history + # entries stored to 1000: + # + # IRB.conf[:SAVE_HISTORY] = 1000 def save_history=(val) IRB.conf[:SAVE_HISTORY] = val if val