hanschen / vim-ipython-cell

Seamlessly run Python code in IPython from Vim
GNU General Public License v3.0
331 stars 18 forks source link

use ipython-cells package as the backend #3

Closed astier closed 4 years ago

astier commented 4 years ago

There is a package ipython-cells which enhances ipython with commands like %cell_run cell_name to run cells with the specified name directly from ipython. The cell-name is specified via comments in the code similar how you do it. Take a look at the link above for better explanation. My proposal would be to use this as the backend to define and run cells.

Basically you would define cells as required by the package ipython-cells. Commands like :IPythonCellExecuteCell would simply search for the magic comment with the cell-name. Then it could just send via slime to ipython the command cell_run cell-name to execute the cell.

This would have the following benefits:

hanschen commented 4 years ago

That's a cool idea (I didn't know about ipython-cells before), but I think I want to keep vim-ipython-cell as it currently is with support for Vim marks and no dependency on ipython packages (although you're right that this would get rid of xsel/xclip dependency).

So instead, I encourage you to develop a separate Vim plugin that addresses this need. If you're new to Vim plugin development you could use this plugin as a starting point, the actual functionality should be relatively straightforward to implement in Python.

astier commented 4 years ago

Hi. Thanks for the advice. Although my idea has some benefits I think there are also reasons against it. Your approach to define cells which are not just bound to ipython is more generic. Creating cell-objects would be cool such that operations like dac (delete around cell) would be possible. But this are just ideas. Right now I have no time. Need to focus on studies. Lost already to much time tweaking vim haha