Re: New IPython 5 prompt
Thorsten Kampe <[email protected]> Sun, 21 Aug 2016 16:46:32 +0200
| Newsgroups | gmane.comp.python.ipython.user |
|---|---|
| Message-ID | <[email protected]> |
* Carl Smith (Sun, 21 Aug 2016 13:32:11 +0100)
> This was discussed here a little while ago. You can probably figure
> out what you need from that:
>
> http://python.6.x6.nabble.com/IPython-5-Docs-Custom-Terminal-Prompts-td5194562.html
Thanks, it looks like the documentation has been updated after the
attempt to work out the new way of customzing prompts:
<http://ipython.readthedocs.io/en/latest/config/details.html#MyPrompt
s>
So this is what I came up with:
"""
config = get_config()
TIS = config.TerminalInteractiveShell
from IPython.terminal.prompts import Prompts, Token
class CustomPrompts(Prompts):
def in_prompt_tokens(self, cli = None):
return [(Token.Prompt, '>>> ')]
def out_prompt_tokens(self):
return [(Token.OutPrompt, '')]
def continuation_prompt_tokens(self, cli = None, width = None):
return [(Token.Prompt, '...')]
TIS.prompts_class = CustomPrompts
"""
Unfortunately setting color (like `'{color.LightCyan}>>> '` seems not
to be supported anymore.
In all, a substantial loss of ease of configuration for IPython
users. "pretty low lever" as the developer said.
Thorsten