Reputation: 11038
Running !import code; code.interact(local=vars())
inside the pdb
prompt allows you to input multiline statements(e.g. a class definition) inside the debugger(source). Is there any way to omit having to copy paste/type that full line each time?
I was thinking about Conque
for vim
and setting something like :noremap ,d i!import code; code.interact(local=vars())<Esc>
but editing anything outside of insert mode doesn't seem to have any effect on the prompt.
Upvotes: 3
Views: 2560
Reputation: 3023
PDB reads in a .pdbrc
when it starts. From the Python docs:
If a file .pdbrc exists in the user’s home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file.
So try creating that file and putting that command in there as is.
Upvotes: 6