Skip to content

Instantly share code, notes, and snippets.

@kirel
Created July 19, 2012 13:06
Show Gist options
  • Save kirel/3143777 to your computer and use it in GitHub Desktop.
Save kirel/3143777 to your computer and use it in GitHub Desktop.
# vim FTW
Pry.config.editor = "mvim"
# Prompt with ruby version
Pry.prompt = [proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }]
if defined?(Rails) && Rails.env
begin
extend Rails::ConsoleMethods if defined?(Rails::ConsoleMethods)
require "rails/console/app"
require "rails/console/helpers"
rescue LoadError => e
require "console_app"
require "console_with_helpers"
end
end
begin
require "awesome_print"
Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) }
rescue LoadError => err
warn "=> Unable to load awesome_print"
end
begin
require "hirb"
Hirb.enable
lambda do
_pry_print = Pry.config.print
Pry.config.print = proc { |output, value| Hirb::View.view_or_page_output(value) || _pry_print.call(output, value) }
end.call
rescue LoadError
warn "=> Unable to load hirb"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment