Skip to content

Instantly share code, notes, and snippets.

@klochner
Created October 1, 2010 19:21
Show Gist options
  • Save klochner/606704 to your computer and use it in GitHub Desktop.
Save klochner/606704 to your computer and use it in GitHub Desktop.
def history(num=100)
h = Readline::HISTORY.to_a
start = [0,h.size-num-1].max
h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
puts " #{(i).to_s.rjust(4)} #{e}"
end;nil
end
>> history(7)
483 def history(num=100)
484 h = Readline::HISTORY.to_a
485 start = [0,h.size-num-1].max
486 h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
487 puts " #{(i).to_s.rjust(4)} #{e}"
488 end;nil
489 end
490 history(7)
@klochner
Copy link
Author

klochner commented Oct 1, 2010

bash style history command for irb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment