Add python REPL configs
- Rich for prettification - Don't write a python_history
This commit is contained in:
parent
661917f37d
commit
1654c2ebf6
2 changed files with 24 additions and 0 deletions
21
.config/pythonrc
Normal file
21
.config/pythonrc
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
try:
|
||||||
|
import readline
|
||||||
|
except ImportError:
|
||||||
|
print("Module readline not available.")
|
||||||
|
else:
|
||||||
|
# Add tab completion
|
||||||
|
import rlcompleter
|
||||||
|
readline.parse_and_bind("tab: complete")
|
||||||
|
|
||||||
|
# Don't write history on exit
|
||||||
|
readline.write_history_file = lambda *args: None
|
||||||
|
|
||||||
|
|
||||||
|
# Try to install rich's prettification stuff
|
||||||
|
try:
|
||||||
|
from rich import pretty
|
||||||
|
except ImportError:
|
||||||
|
print("Failed to import Rich for CLI prettification")
|
||||||
|
else:
|
||||||
|
pretty.install()
|
||||||
|
|
3
.profile
3
.profile
|
@ -22,3 +22,6 @@ fi
|
||||||
export HISTFILE=~/.history
|
export HISTFILE=~/.history
|
||||||
export HISTSIZE=10000
|
export HISTSIZE=10000
|
||||||
export SAVEHIST=10000
|
export SAVEHIST=10000
|
||||||
|
|
||||||
|
# Use my special pythonrc to customize my REPL
|
||||||
|
export PYTHONSTARTUP=~/.config/pythonrc
|
||||||
|
|
Loading…
Add table
Reference in a new issue