-
~/.pythonstartup.py
とか適当に置く -
~/.zshrc
なり~/.bashrc
なりに以下を追記export PYTHONSTARTUP=${HOME}/.pythonstartup.py
-
インタラクティブシェルで補完が出来て
~/.python_history
に history 出るよ
Last active
August 5, 2017 17:47
-
-
Save laughk/12bb6e1fde485fe4e5b8 to your computer and use it in GitHub Desktop.
python インタラクティブシェルで補完とhistoryを取得する奴
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
# -*- coding:utf-8 -*- | |
# Python startup file | |
import readline | |
import rlcompleter | |
import atexit | |
import os | |
# tab complete | |
readline.parse_and_bind('tab: complete') | |
# history file | |
histfile = os.path.join(os.environ['HOME'], '.python_history') | |
try: | |
readline.read_history_file(histfile) | |
except IOError: | |
pass | |
atexit.register(readline.write_history_file, histfile) | |
del os, histfile, readline, rlcompleter, atexit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment