-
Notifications
You must be signed in to change notification settings - Fork 2
/
irbrc
54 lines (45 loc) · 1.26 KB
/
irbrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# encoding: UTF-8
require 'pp'
require 'rubygems'
require 'irb/completion'
require 'irb/ext/save-history'
require 'mkmf'
IRB.conf[:SAVE_HISTORY] = 1_000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
module ANSI
Reset = "\e[0m"
Bold = "\e[1m"
Underline = "\e[4m"
LightGrey = "\e[0;37m"
Grey = "\e[1;30m"
Red = "\e[31m"
Green = "\e[32m"
Yellow = "\e[33m]"
Blue = "\e[34m"
Magenta = "\e[35m"
Cyan = "\e[36m"
White = "\e[37m"
end
IRB.conf[:PROMPT][:OLIVERNN] = {
:PROMPT_I => "#{ANSI::Red + ANSI::Bold}ruby (#{RUBY_VERSION})\n✎ #{ANSI::Reset}",
:PROMPT_S => "",
:PROMPT_C => "",
:PROMPT_N => "",
:RETURN => "#{ANSI::White}%s\n#{ANSI::Reset}",
:AUTO_INDENT => true
}
IRB.conf[:PROMPT_MODE] = :OLIVERNN
def pbcopy(data, path = nil)
if pbcopy_path = find_executable0("pbcopy", path)
IO.popen(pbcopy_path, 'w') { |io| io.write(data) }
else
fail NotImplementedError, "pbcopy is not available in #{path.nil? ? ENV['PATH'] : path}"
end
end
def pbpaste(path = nil)
if pbpaste_path = find_executable0("pbpaste", path)
IO.popen(pbpaste_path, 'r').read
else
fail NotImplementedError, "pbpaste is not available in #{path.nil? ? ENV['PATH'] : path}"
end
end