rhysd / reply.vim

REPLs play nicely with :terminal on Vim and Neovim
MIT License
186 stars 7 forks source link

ReplRecv only supports ptpython classic `prompt_start` #4

Closed rbpatt2019 closed 5 years ago

rbpatt2019 commented 5 years ago

Expected Behavior :ReplRecv sends code from REPL to buffer regardless of REPL

Actual Behavior :ReplRecv does nothing (no errors, no sent text, though command runs) if REPL is ptpython

Steps to Reproduce

System Info Vim: 8.1, Patches 1-877, Huge Version, without GUI Terminal Emulator: kitty 0.13.3-1 OS: Manjaro-compiled Arch Linux, Kernel 4.20.11-1

Additional Comments Absolutely love the plugin! I was formerly using vim slime, but have made the switch, and don't regret it!

I nearly exclusively code python, and generally use the ptpython REPL. I can send code from by buffer to the REPL, no problems. When I try to call :ReplRecv to send code from the ptpython REPL to my buffer, nothing happens. No errors are raised, my statusbar shows the command ran, just absolutely nothing happens. While troubleshooting, I've found that it doesn't matter whether the mappings are defined in my vimrc or an ftplugin file (happens in both cases), it doesn't matter if the mappings are global or buffer specific (happens in both cases), and it doesn't matter whether I issue :ReplRecv from the REPL or buffer window (happens in both cases), but it does matter what REPL I'm running. If I switch to python as my REPL, I can send and receive with no issues.

The ability to send from the REPL back to the buffer was a huge part of why I ditched vim-slime. While not a deal breaker, I would love to be able to send and receive from ptpython!

Time permitting, I plan to fork this repo and see if I can sort the issue. I'll make a PR if I do. Any help you have is greatly appreciated!

rbpatt2019 commented 5 years ago

I just (partially) sorted the issue. I had ptpython configured to use IPython style line beginners, while the code for ptpython only supports classic mode! Currently trying to sort a regex for the IPython style line begninners.

rbpatt2019 commented 5 years ago

And solved! By setting 'prompt_start' : '\vIn [[0-9]+]: ' in autoload/reply.repl/ptpython.vim, I can now send from a ptpython terminal using IPython style line beginnings.

So, as it stands, the plugin supports sending from ptpython if you have repl.prompt_style = 'classic' in your config.py for ptpython. If you have repl.prompt_style = 'ipython' in your config.py for ptpython, you need to change 'prompt_start' as above.

I'll fork this and see if I can add support for a setting to allow users to choose which style they are using.

rbpatt2019 commented 5 years ago

Closed by #5 .