Last active
November 5, 2023 15:32
-
-
Save tschaefer/31b0d907aeffc80262c630f6aa95ae8a to your computer and use it in GitHub Desktop.
Pry user configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
### Prompt | |
Color = Pry::Helpers::Text | |
name = 'zerowing' | |
description = <<~DESC | |
All your prompt are belong to us.👽 | |
user@host:pry /path/to/obj » | |
DESC | |
Pry::Prompt.add( | |
name, | |
description, | |
['»', '%>'] | |
) do |obj, _, _, sep| | |
user = `whoami`.chomp | |
host = `hostname`.chomp | |
exec = 'pry' | |
path = obj.to_s.eql?('main') ? '/' : "/#{obj.to_s.gsub('::', '/')}" | |
format( | |
'%<user>s@%<host>s:%<exec>s %<path>s %<separator>s ', | |
user: Color.white(user), | |
host: Color.blue(host), | |
exec: Color.yellow(exec), | |
path: Color.cyan(path), | |
separator: sep | |
) | |
end | |
Pry.config.prompt = Pry::Prompt[:zerowing] | |
### History | |
Pry.config.history_file = File.expand_path('~/.pry_history') | |
Pry.config.history_save = true | |
Pry.config.history_load = true | |
### Theme | |
Pry.config.theme = 'solarized' if defined?(PryTheme) | |
# vim: set ft=ruby : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment