Skip to content

Instantly share code, notes, and snippets.

@dougc84
Last active December 28, 2015 11:09
Show Gist options
  • Save dougc84/7491875 to your computer and use it in GitHub Desktop.
Save dougc84/7491875 to your computer and use it in GitHub Desktop.
.pryrc
# try requiring and including awesome_print
# if gem is not installed, will simply pass over this.
require "awesome_print"
AwesomePrint.pry! if defined?(AwesomePrint)
#
# output becomes:
#
# [1] app_folder_name development(main)> def something
# 1 > "hello"
# 1 > end
# nil
# [2] app_folder_name development(main)> |
#
Pry.config.prompt_name = "#{File.basename(Dir.pwd)} #{Rails.env}"
Pry.config.prompt = [
proc { |target_self, nest_level, pry|
prompt = "[#{pry.input_array.size}]"
prompt += " #{Pry.config.prompt_name}"
prompt += "(#{Pry.view_clip(target_self)})"
prompt += "#{":#{nest_level}" unless nest_level.zero?}> "
prompt
}, proc { |target_self, nest_level, pry|
prompt = "[#{pry.input_array.size}]"
prompt += " #{Pry.config.prompt_name}"
prompt += "(#{Pry.view_clip(target_self)})"
prompt += "#{":#{nest_level}" unless nest_level.zero?}"
prompt = ([' ']*prompt.length).join('')
prompt = prompt[0...-(pry.input_array.size.to_s.length + 2)]
prompt += " #{pry.input_array.size} "
prompt += "> "
prompt
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment