[ruby] Add Ruby configs

pull/28/head
Alpha Chen 10 years ago
parent 4e81dec0f8
commit c5d3ff3524

@ -16,7 +16,9 @@
vars: vars:
stow_packages: stow_packages:
- git - git
- ruby
- tmux - tmux
- vim
tasks: tasks:
- name: clone/update dotfiles - name: clone/update dotfiles
git: repo=https://github.com/kejadlen/dotfiles.git dest=~/.dotfiles git: repo=https://github.com/kejadlen/dotfiles.git dest=~/.dotfiles

@ -0,0 +1 @@
gem: --no-document

@ -0,0 +1,35 @@
require 'irb/completion'
require 'irb/ext/save-history' unless RUBY_ENGINE == 'macruby'
require 'pp'
# tab completion
ARGV.concat %w[ --readline --prompt-mode simple ] unless RUBY_ENGINE == 'macruby'
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
irbrc_local = File.expand_path('../.irbrc.local', __FILE__)
require irbrc_local if File.exists?(irbrc_local)
begin
# use Pry if it exists
require 'pry'
Pry.start || exit
rescue LoadError
end

@ -0,0 +1,26 @@
Pry.config.editor = 'vim'
Pry.prompt = [
proc { |target, _, _| "(#{Pry.view_clip(target)})> " },
proc { |target, _, _| "(#{Pry.view_clip(target)})| " },
]
begin
require 'pry-debugger'
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'u', 'finish' # up
Pry.commands.alias_command 'b', 'break'
rescue LoadError
end
def pbcopy(str)
IO::popen(%w[pbcopy], 'w') {|io| io.write str }
end
def tic; @_tic = Time.now; end
def toc; Time.now - @_tic; end
pryrc_local = File.expand_path('../.pryrc.local', __FILE__)
load pryrc_local if File.exists?(pryrc_local)
Loading…
Cancel
Save