Skip to content

Instantly share code, notes, and snippets.

@SebCorbin
Created April 29, 2020 13:41
Show Gist options
  • Save SebCorbin/a22335e6bf237ea10cfe35a2bba7a377 to your computer and use it in GitHub Desktop.
Save SebCorbin/a22335e6bf237ea10cfe35a2bba7a377 to your computer and use it in GitHub Desktop.

Revisions

  1. SebCorbin created this gist Apr 29, 2020.
    42 changes: 42 additions & 0 deletions .pdbrc.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    """
    This is a custom configuration file for pdb++, put it in home dir.
    """

    import readline
    import pdb

    class Config(pdb.DefaultConfig):
    filename_color = pdb.Color.lightgray
    use_terminal256formatter = False
    sticky_by_default = True # start in sticky mode

    def __init__(self):
    # Save history across sessions
    import readline
    histfile = ".pdb-pyhist"
    try:
    readline.read_history_file(histfile)
    except IOError:
    pass
    import atexit
    atexit.register(readline.write_history_file, histfile)
    readline.set_history_length(500)

    try:
    from pygments.formatters import terminal
    except ImportError:
    pass
    else:
    self.colorscheme = terminal.TERMINAL_COLORS.copy()
    self.colorscheme.update({
    terminal.Keyword: ('darkred', 'red'),
    terminal.Number: ('darkyellow', 'yellow'),
    terminal.String: ('brown', 'green'),
    terminal.Name.Function: ('darkgreen', 'blue'),
    })

    def setup(self, pdb):
    # make 'l' an alias to 'longlist'
    Pdb = pdb.__class__
    Pdb.do_l = Pdb.do_longlist
    Pdb.do_st = Pdb.do_sticky