Skip to content

Instantly share code, notes, and snippets.

@geoffjay
Created March 16, 2023 19:26
Show Gist options
  • Save geoffjay/d6fce4015c6634b01e792a56e2ce2d4d to your computer and use it in GitHub Desktop.
Save geoffjay/d6fce4015c6634b01e792a56e2ce2d4d to your computer and use it in GitHub Desktop.

Revisions

  1. geoffjay created this gist Mar 16, 2023.
    42 changes: 42 additions & 0 deletions .pryrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # vim:filetype=ruby

    # colours
    BLACK = "\001\e[0;30m\002"
    RED = "\001\e[0;31m\002"
    GREEN = "\001\e[0;32m\002"
    YELLOW = "\001\e[0;33m\002"
    BLUE = "\001\e[0;34m\002"
    MAGENTA = "\001\e[0;35m\002"
    CYAN = "\001\e[0;36m\002"
    WHITE = "\001\e[0;37m\002"
    RESET = "\001\e[0m\002"

    # editor setup
    Pry.editor = "vi"

    # require "awesome_print"

    # custom prompt
    Pry.prompt = [
    proc { |target_self, nest_level, pry|
    line_num = pry.input_array.size
    prompt = "#{line_num} "
    "#{MAGENTA}#{prompt}#{RESET}"
    },
    proc { |target_self, nest_level, pry|
    prompt = ". "
    "#{MAGENTA}#{prompt}#{RESET}"
    }
    ]

    Pry.config.ls.separator = "\n" # new lines between methods
    Pry.config.ls.heading_color = :magenta
    Pry.config.ls.public_method_color = :green
    Pry.config.ls.protected_method_color = :yellow
    Pry.config.ls.private_method_color = :bright_black

    # when used through vim
    if ENV["VIM"]
    puts "Pry is running inside Vim. Disabling pager."
    Pry.config.pager = false
    end