Ask Your Question

Revision history [back]

The sage prompt is set in the file src/sage/repl/prompts.py, you can just modify the line 23 and rebuild (make build from Sage root). See the file at https://git.sagemath.org/sage.git/tree/src/sage/repl/prompts.py

The sage prompt is set in the file src/sage/repl/prompts.py, you can just modify the line 23 and rebuild (make build from Sage root). See the file at https://git.sagemath.org/sage.git/tree/src/sage/repl/prompts.py

Alternatively, within Sage console (or in your ~/.sage/init.sage file), you can type:

from IPython.terminal.prompts import ClassicPrompts
ip = get_ipython()
ip.prompts = ClassicPrompts(ip)

The sage prompt is set in the file src/sage/repl/prompts.py, you can just modify the line 23 and rebuild (make build from Sage root). See the file at https://git.sagemath.org/sage.git/tree/src/sage/repl/prompts.py

Alternatively, within Sage console (or in your ~/.sage/init.sage file), you can type:

from IPython.terminal.prompts import ClassicPrompts
ip = get_ipython()
ip.prompts = ClassicPrompts(ip)

If you want to make your own custom prompt (not the Python classical one), you can do:

from IPython.terminal.prompts import Prompts, Token
class MyPrompt(Prompts):
    def in_prompt_tokens(self, cli=None):
        return [(Token.Prompt, 'hello: ')]
ip = get_ipython()
ip.prompts = MyPrompt(ip)

See the documentation at https://ipython.readthedocs.io/en/stable/config/details.html