Skip to content

Instantly share code, notes, and snippets.

@higaki
Created June 29, 2012 11:12
Show Gist options
  • Save higaki/3017386 to your computer and use it in GitHub Desktop.
Save higaki/3017386 to your computer and use it in GitHub Desktop.
.irbrc
# -*- ruby -*-
require 'rubygems'
require 'irb/completion'
IRB.conf[:SAVE_HISTORY] = 65535
IRB.conf[:AUTO_INDENT] = true
def ri(keywd = '')
print `ri #{keywd}`
end
def refe(keywd = '')
print `refe #{keywd}`
end
def sh cmd
print cmd
end
Readline.completion_proc = lambda do |input|
Readline.completion_append_character = nil
IRB::InputCompletor::CompletionProc.call(input)
end
if require('wirb')
def set_color(color, *atom)
atom.each{|a| Wirb.schema[a] = color}
end
set_color [:red], :nil, :false, :true
set_color [:cyan], :symbol, :symbol_string
set_color [:cyan], :symbol_prefix, :open_symbol_string, :close_symbol_string
set_color [:magenta], :string
set_color [:magenta], :open_string, :close_string
set_color [:magenta], :regexp
set_color [:magenta], :open_regexp, :close_regexp, :regexp_flags
set_color [:blue], :number
set_color [:green], :class
set_color ["gray"], :refers
set_color [:green],
:open_object, :close_object,
:object_class,
:object_address,
:object_description, :object_description_prefix,
:object_variable_prefix, :object_variable
set_color ["gray"],
:open_array, :close_array,
:comma,
:open_hash, :close_hash,
:range
set_color [:black],
:open_rational, :close_rational
undef set_color
Wirb.start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment