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

Better interface to IPyRun #54

Open
randomgeek78 opened this issue Jul 1, 2020 · 0 comments
Open

Better interface to IPyRun #54

randomgeek78 opened this issue Jul 1, 2020 · 0 comments

Comments

@randomgeek78
Copy link

randomgeek78 commented Jul 1, 2020

Hi,

I have been using vim-ipython-cell to interface with ipython. Recently, my workflow included driving qtconsole from vim and discovered this plugin after trying a few alternatives. I love this plugin and it has been working to work with. But I miss the navigation features of vim-ipython-cell which drives ipython through vim-slime. I am trying to get it to talk to nvim-ipy instead to drive jupyter console instead.

I was able to get most of the functionality by making a few likes of change to both nvim-ipy and vim-ipython-cell. The main change to nvim-ipy was to create a better interface to IPyRun by adding the following:

diff --git i/plugin/ipy.vim w/plugin/ipy.vim
index 4a16464..9cbdb4b 100644
--- i/plugin/ipy.vim
+++ w/plugin/ipy.vim
@@ -1,6 +1,7 @@
 command! -nargs=* IPython :call IPyConnect(<f-args>)
 command! -nargs=* IPython2 :call IPyConnect("--kernel", "python2")
 command! -nargs=* IJulia :call IPyConnect("--kernel", "julia-0.4")
+command! -nargs=+ IPyRun1 :call IPyRun(<q-args> . "\r")

 nnoremap <Plug>(IPy-Word) <Cmd>call IPyRun(expand("<cword>"))<cr>
 nnoremap <Plug>(IPy-Run) <Cmd>call IPyRun(getline('.')."\n")<cr>

This creates a command called IPyRun1 that takes care of all the escaping needed to call it from python environment running within vim. Without this, escaping strings to send to jupyter was extremely problematic.

I think this interface will be generally useful too to be included in nvim-ipy.

Thoughts/suggestions?

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

1 participant