Improve pryrc

This commit is contained in:
Henrik Lissner 2014-10-25 16:38:19 -04:00
parent 8a4cd2feae
commit 9cde0bd69f

17
pryrc
View file

@ -9,11 +9,28 @@ Pry.config.prompt = [
proc { |obj, nest_level, _| "#{prompt} (#{obj}):#{nest_level} * " } proc { |obj, nest_level, _| "#{prompt} (#{obj}):#{nest_level} * " }
] ]
if defined?(PryByebug)
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
end
# Repeat last command with enter
default_command_set = Pry::Commands.command /^$/, 'repeat last command' do
_pry_.run_command Pry.history.to_a.last
end
Pry.config.commands.import(default_command_set)
# https://github.com/michaeldv/awesome_print/ # https://github.com/michaeldv/awesome_print/
# $ gem install awesome_print # $ gem install awesome_print
begin
require 'awesome_print' require 'awesome_print'
AwesomePrint.defaults = { indent: -2 } AwesomePrint.defaults = { indent: -2 }
AwesomePrint.pry! AwesomePrint.pry!
rescue LoadError
puts 'awesome_print not installed'
end
## Benchmarking ## Benchmarking
# Inspired by <http://stackoverflow.com/questions/123494/whats-your-favourite-irb-trick/123834#123834>. # Inspired by <http://stackoverflow.com/questions/123494/whats-your-favourite-irb-trick/123834#123834>.