Last active
January 23, 2019 13:18
-
-
Save yakimka/10b83754dedd1484a5ae255e648ced5d to your computer and use it in GitHub Desktop.
Default python interpreter prompts for ipython
This file contains hidden or 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
# $ ipython profile create | |
# $ cat ~/.ipython/profile_default/startup/python_interp_prompt.py | |
from IPython.terminal.prompts import Prompts, Token | |
import os | |
class PythonShellPrompt(Prompts): | |
def in_prompt_tokens(self, cli=None): | |
return [(Token.Prompt, '>>> ')] | |
def out_prompt_tokens(self): | |
return [(Token.Prompt, '')] | |
def continuation_prompt_tokens(self, cli=None, width=None): | |
return [(Token.Prompt, '... ')] | |
ip = get_ipython() | |
ip.prompts = PythonShellPrompt(ip) | |
# https://ipython.readthedocs.io/en/stable/config/details.html#MyPrompts.continuation_prompt_tokens |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment