Skip to content

Instantly share code, notes, and snippets.

@yakimka
Last active January 23, 2019 13:18
Show Gist options
  • Save yakimka/10b83754dedd1484a5ae255e648ced5d to your computer and use it in GitHub Desktop.
Save yakimka/10b83754dedd1484a5ae255e648ced5d to your computer and use it in GitHub Desktop.
Default python interpreter prompts for ipython
# $ 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