sillybun / vim-repl

Best REPL environment for Vim
GNU General Public License v2.0
446 stars 39 forks source link

Configure python prompt #121

Closed nooproblem closed 3 years ago

nooproblem commented 3 years ago

Hi,

Firstly, thanks for this great plugin, I really appreciate it!

In your details section , the ZTYREPL terminal pane in the gifs has different python prompt to the default >>>. I found that you can set PYTHONSTARTUP to file which contains sys.ps1 and sys.ps2 in order to configure the python prompt, but I am not sure configure this for vim-repl. How did you do this?

Thanks in advance! np

sillybun commented 3 years ago

The prompt is hard-coded in vim-reply line 463-468:

                if l:sn ==# 'ptpython'
                    call repl#Sends(repl#ToREPLPythonCode(l:code_tobe_sent, 'ptpython'), ['\.\.\.', '>>>', 'ipdb>', 'pdb>'])
                elseif l:sn ==# 'ipython'
                    call repl#Sends(repl#ToREPLPythonCode(l:code_tobe_sent, 'ipython'), ['\.\.\.', 'In'])
                elseif l:sn =~# 'python' || l:sn =~# 'python3'
                    call repl#Sends(repl#ToREPLPythonCode(l:code_tobe_sent, 'python'), ['>>>', '...', 'ipdb>', 'pdb>'])
sillybun commented 3 years ago

Also in function repl#SendLines:

        if l:sn ==# 'ptpython'
            call repl#Sends(repl#ToREPLPythonCode(getline(l:firstline, a:last), 'ptpython'), ['\.\.\.', '>>>', 'ipdb>', 'pdb>'])
        elseif l:sn ==# 'ipython'
            call repl#Sends(repl#ToREPLPythonCode(getline(l:firstline, a:last), 'ipython'), ['\.\.\.', 'In'])
        elseif l:sn =~# 'python' || l:sn =~# 'python3'
            call repl#Sends(repl#ToREPLPythonCode(getline(l:firstline, a:last), 'python'), ['>>>', '...', 'ipdb>', 'pdb>'])
nooproblem commented 3 years ago

Thanks! Solved this with :REPLToggle python3 -i /path/to/.pythonrc