Skip to content

Commit

Permalink
Get rid of powerline symbols in pry
Browse files Browse the repository at this point in the history
  • Loading branch information
duien committed Sep 23, 2016
1 parent 968eb0b commit a737f1b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions home/.pryrc
Expand Up @@ -66,16 +66,16 @@ include Colorer
# Since there's often setup you do only if you load a gem in that situation, you can also pass a block to
# the require and it'll execute it only if the gem was succcessfully loaded.
#
def require_maybe_outside_bundler(gem)
def require_maybe_outside_bundler(gem_name)
begin
require gem
rescue LoadError => e
print italic("Looking for #{gem}... ")
require gem_name
rescue LoadError
print italic("Looking for #{gem_name}... ")

if defined? Bundler
Bundler.with_clean_env do
to_load = [gem]
to_load += `gem dependency #{gem} --pipe`.lines.map{ |l| l.match(/([\w_-]+) --/){ |m| m[1] } }.compact
to_load = [gem_name]
to_load += `gem dependency #{gem_name} --pipe`.lines.map{ |l| l.match(/([\w_-]+) --/){ |m| m[1] } }.compact
to_load.each do |g|
which = `gem which #{g} 2>/dev/null`
if which.empty?
Expand All @@ -84,7 +84,7 @@ def require_maybe_outside_bundler(gem)
$LOAD_PATH << File.dirname(which)
end
begin
require gem
require gem_name
puts green("Success!")
rescue LoadError
return puts red("Failed to require after updating LOAD_PATH.")
Expand Down Expand Up @@ -128,17 +128,18 @@ prompt = proc { |target_self, nest_level, pry|
[
on_white(black(" #{pry.input_array.size} ")),
Pry.config.prompt_name ? [
white(on_num(prompt_name_color, powerline_symbols[:right_arrow])),
# white(on_num(prompt_name_color, powerline_symbols[:right_arrow])),
on_num(prompt_name_color, " "),
on_num(prompt_name_color, white("#{rails_sym}#{Pry.config.prompt_name} ")),
num(prompt_name_color, on_red(powerline_symbols[:right_arrow])),
# num(prompt_name_color, on_red(powerline_symbols[:right_arrow])),
] : [
white(on_red(powerline_symbols[:right_arrow]))
# white(on_red(powerline_symbols[:right_arrow]))
],
on_red(" "),
on_red(num(88, tree.join(" #{powerline_symbols[:right_separator]} "))),
# on_red(num(88, tree.join(" #{powerline_symbols[:right_separator]} "))),
on_red(num(88, tree.join('>'))),
on_red(white("#{Pry.view_clip(target_self)} ")),
red(powerline_symbols[:right_arrow]),
# red(powerline_symbols[:right_arrow]),
" "
].flatten.join
}
Expand All @@ -147,7 +148,8 @@ Pry.prompt = [
prompt,
proc { |target_self, nest_level, pry|
prompt_str = uncolor(prompt.call(target_self, nest_level, pry))[0...-2]
prompt_str.gsub!(powerline_symbols[:right_arrow], powerline_symbols[:right_separator])
"#{dim(prompt_str)}#{red(powerline_symbols[:right_separator])} "
# prompt_str.gsub!(powerline_symbols[:right_arrow], powerline_symbols[:right_separator])
# "#{dim(prompt_str)}#{red(powerline_symbols[:right_separator])} "
"#{dim(prompt_str)} "
}
]

0 comments on commit a737f1b

Please sign in to comment.