Skip to content

Instantly share code, notes, and snippets.

@ongaeshi
Created March 17, 2011 07:26
Show Gist options
  • Select an option

  • Save ongaeshi/873973 to your computer and use it in GitHub Desktop.

Select an option

Save ongaeshi/873973 to your computer and use it in GitHub Desktop.
.irbrc
#
# setup
#
require 'rubygems'
require 'rubywho'
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 50000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
#
# edit commands
#
def edit
system "vi ~/.temp.rb"
end
def new
system "rm ~/.temp.rb; vi ~/.temp.rb"
end
def vi(arg)
system "vi #{arg}"
end
#
# run commands
#
def run(*args)
system "ruby ~/.temp.rb #{args.to_s}"
end
def ruby(arg)
system "ruby #{arg}"
end
#
# directory commands
#
def ls(*args)
system "ls #{args.to_s}"
end
def pwd
Dir::pwd
end
def cd(arg)
Dir::chdir(arg)
end
def mkdir(arg)
Dir::mkdir(arg)
end
#
# file commnads
#
def cat(arg)
system "cat #{arg}"
end
def less(arg)
system "less #{arg}"
end
def cp(arg)
system "cp #{arg}"
end
def mv(arg)
system "mv #{arg}"
end
def rm(arg)
system "rm #{arg}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment