You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

require 'pp'
1 year ago
# make it more pry-like
IRB.conf[:PROMPT][:ALPHA] = {
:PROMPT_I => "[%n] %N(%m)> ",
:PROMPT_S => "[%n] %N(%m)> ",
:PROMPT_C => "[%n] %N(%m)* ",
:RETURN => "=> %s\n",
}
IRB.conf[:PROMPT_MODE] = :ALPHA
# use type completor if available
begin
require "repl_type_completor"
IRB.conf[:COMPLETOR] = :type
rescue LoadError
end
1 year ago
1 year ago
if defined?(Reline::Face) # https://github.com/ruby/irb/issues/328
Reline::Face.config(:completion_dialog) do |conf|
conf.define :default, foreground: :black, background: :cyan
conf.define :enhanced, foreground: :black, background: :magenta
conf.define :scrollbar, foreground: :white, background: :blue
end
end
1 year ago
## utility functions
1 year ago
def pbcopy(str=nil)
str = yield if block_given?
IO.popen(%w[pbcopy], 'w') {|io| io.write str }
end
1 year ago
def tic; @_tic = Time.now; end
def toc; Time.now - @_tic; end
1 year ago
# IRB.conf[:AUTO_INDENT] = true
# IRB.conf[:EVAL_HISTORY] = 1000
# IRB.conf[:SAVE_HISTORY] = 1000
# IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
# shut irb up
# IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE] ][:RETURN] = ''
# require 'wirble'
# def pc(*ary)
# ary.each do |obj|
# puts Wirble::Colorize.colorize(obj.inspect)
# end
# end
# def history
# Readline::HISTORY.to_a
# end
1 year ago
irbrc_local = File.expand_path(".irbrc.local", __dir__)
require irbrc_local if File.exist?(irbrc_local)