Repository navigation
Expand file tree
/
Copy path.pryrc
More file actions
60 lines (50 loc) · 1.57 KB
/
Copy path.pryrc
File metadata and controls
60 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## Settings
Pry.config.color = true
Pry.config.editor = "vim"
Pry.config.prompt = proc do |obj, level, _|
prompt = ""
prompt << "#{Rails.version}@" if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})> "
end
## Alias
Pry.config.commands.alias_command "lM", "ls -M"
# Ever get lost in pryland? try w!
Pry.config.commands.alias_command 'w', 'whereami'
# Clear Screen
Pry.config.commands.alias_command '.clr', '.clear'
## Below others cooperation
# refs: https://github.com/pry/pry/wiki/FAQ#wiki-awesome_print
# if defined? AwesomePrint
# begin
# require 'awesome_print'
# Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) }
# # Pry.config.print = proc { |output, value| output.puts value.ai } #ページングなし
# rescue LoadError => err
# puts "no awesome_print :("
# puts err
# end
# end
# refs: https://github.com/pry/pry/wiki/FAQ#wiki-hirb
if defined? Hirb
Hirb::View.instance_eval do
def enable_output_method
@output_method = true
Pry.config.print = proc do |output, value, _pry_|
Hirb::View.view_or_page_output(value) || Pry::DEFAULT_PRINT.call(output, value, _pry_)
end
end
def disable_output_method
Pry.config.print = @old_print
@output_method = nil
end
end
Hirb.enable
end
# refs: https://github.com/nixme/pry-debugger#tips
if defined?(PryDebugger)
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