Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to use NeoVim terminal? #22

Open
khughitt opened this issue Jul 13, 2016 · 7 comments
Open

Possible to use NeoVim terminal? #22

khughitt opened this issue Jul 13, 2016 · 7 comments

Comments

@khughitt
Copy link

I just tested on nvim-ipy with a recent version of NeoVim and IPython 4.2.0, and can successfully connect to IPython from NeoVim using :IPython.

Currently, however, commands which are sent to IPython,and the corresponding results are displayed in a NeoVim buffer.

Instead of using a buffer, would it be possible to make use of NeoVim's built-in terminal support? This way, in addition to send commands to the terminal, one could also interact with the IPython console directly in NeoVim.

This has been done with R, for example: https://github.com/jalvesaq/Nvim-R

Is this something that might be possible with IPython as well?

@scottstanfield
Copy link

Adding my support for this. I use R + neovim (with the Terminal method mentioned above) and it's brilliant. But I need to work with Python too. Would love this big feature.

@jduc
Copy link

jduc commented Sep 23, 2016

It would be great indeed. In the meantime, there is a nice little plugin that I have been using for python, it supports terminal as for the R plugin. It's early in dev and simple but it does the job: https://github.com/hkupty/iron.nvim

@bfredl
Copy link
Owner

bfredl commented Sep 23, 2016

In principle this shouldn't be too hard, after launching the kernel in nvim-ipy, also connect to it in a :terminal using jupyter console --existing {connectionfile}. We should add a helper function that determines the connectionfile and puts together the :term command.

@bfredl
Copy link
Owner

bfredl commented Sep 23, 2016

A simple proof of concept here #24, note you still need to launch :IPython first, then do :IPySplitTerm . A limitation in jupyter console is though that it only shows output from the terminal in the terminal, so you currently still need to use the [jupyter] buffer to get output from nvim.

@DerWeh
Copy link

DerWeh commented Apr 9, 2017

@bfredl I think there is already the solution to this limitation. The most maintained fork of vim-ipython is by wilywampa, he added a lot of improvement, you should look into it.

Among his changes is a script monitor.py.
It could be run in the background, then when the jupyter console is launched it attaches to the kernel and echos what is processed.
I had this working with python2, somehow I can't get this to work right now. But I am working on WSL, which has some problems with jupyter console. The script might give you some insight anyway.

@bfredl
Copy link
Owner

bfredl commented Apr 10, 2017

I don't see how the monitor script will help, it would just show the input/output which the [Jupyter] buffer already does, it does not allow any interaction in the terminal.

@DerWeh
Copy link

DerWeh commented Apr 10, 2017

I did some testing, apparently it works with ipython console but not with jupyter console. Sadly I have no insight how it works to fix this.

How does it help

In a terminal you can do the following:

python monitor.py&
ipython console

Now you have an ipython console to work with, but it will also print what connected sessions execute.
I used it with vim-ipython, having one terminal with the ipython console and another one with vim. The ipython console printed everything I sent with vim.

What are the problems

nvim-ipy seems to work differently, monitor.py doesn't print things from it. Also it works only with ipython console, not with jupyter console Also it seems to not work when run form within neovim. The combination of neovim's :terminal and vim-ipython works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants