Skip to content

Instantly share code, notes, and snippets.

@Traz
Last active December 15, 2015 15:09
Show Gist options
  • Save Traz/5279557 to your computer and use it in GitHub Desktop.
Save Traz/5279557 to your computer and use it in GitHub Desktop.
Some attempt to build a nice PRY set up file :) .pryrc
Pry.config.auto_indent = true
Pry.config.color = true
Pry.config.editor = "vim"
#Pry.config.prompt = Pry::DEFAULT_PROMPT
Pry.config.history.file = "~/pry_history"
Pry.config.hooks.add_hook(:before_session, :say_hi_lazza) do
puts "\n\nHi Traz !\nRuby#{RUBY_VERSION}\n\n"
end
Pry.config.hooks.add_hook(:after_session, :say_bye_lazza) do
puts "\n\nbye-bye Traz !\n\n"
end
# from <https://github.com/pry/pry/blob/master/lib/pry.rb>
Pry.prompt = [
proc { |target_self, nest_level, pry|
"[#{pry.input_array.size}]\e[0;33m\ #{Pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}>\e[0m\ "
},
proc { |target_self, nest_level, pry|
"[#{pry.input_array.size}]\e[0;33m\ #{Pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}*\e[0m\ "
}
]
require 'rubygems'
require 'looksee'
# theme on win work only with 8 and 16 colors
# Pry.config.theme = "railscasts"
# require 'awesome_print'
# AwesomePrint.pry!
# require 'wirble'
# Wirble.init
# Wirble.colorize
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Dirty hack to support in-session Hirb.disable/enable
Hirb::View.instance_eval do
def enable_output_method
@output_method = true
Pry.config.print = proc do |output, value|
Hirb::View.view_or_page_output(value) || Pry::DEFAULT_PRINT.call(output, value)
end
end
def disable_output_method
Pry.config.print = proc { |output, value| Pry::DEFAULT_PRINT.call(output, value) }
@output_method = nil
end
end
Hirb.enable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment