IRB History and colors with Wirble

For a nicer irb experience there is wirble, a gem that adds history and colorization, the only thing missing so far was actual support and bugfixes, which i finally found on blackwinters branch, now history scrolling is fun again 🙂

A small excerpt from my dotfiles irbrc

def require_without_bundler(gem, file)
  return require(file) unless defined?(::Bundler)
  if gem_path = Dir.glob("{#{Gem.path.join(',')}}/gems/#{gem}*").first
    $LOAD_PATH << "#{gem_path}/lib"
    require file
  else
    raise LoadError, "Gem #{gem} not found via require_without_bundler"
  end
end

begin
  # nice history and color
  require_without_bundler 'blackwinter-wirble', 'wirble' # blackwinter branch has history_uniq fixes
  Wirble::History::DEFAULTS[:history_uniq] = 'reverse'

  Wirble.init
  Wirble.colorize
rescue LoadError
  # No wirble use defaults to get at least history
  require 'irb/ext/save-history'
  IRB.conf[:USE_READLINE] = true
  IRB.conf[:SAVE_HISTORY] = 10000
  IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
end
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s