hanschen / vim-ipython-cell

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

Adding EditLine and EditRegion commands #27

Closed gerazov closed 3 years ago

gerazov commented 3 years ago

I've added two commands that allow the user to edit the sent code before executing it. Here's a short demo:

vim-edit-region

This could be useful for adapting code that can not be executed in its original form, e.g. by deleting self. within class methods that reference attributes, so that they can be provided in IPython.

gerazov commented 3 years ago

This might be a bit unnecessary as you can just copy paste in IPython without the need of sending stuff trough Slime :slightly_smiling_face:

Plus indentation can be an issue for longer selections :sweat_smile:

Also moved it to vim-slime as an issue - might be more appropriate.

hanschen commented 3 years ago

Thanks for the pull request! I'm very busy at the moment so unfortunately I won't have time to properly review it until at least this weekend.

In general, I think it would be great if it was included directly in vim-slime, as I think it fits nicely with that plugin.

hanschen commented 3 years ago

Hi @gerazov, how does it look? Do you think the vim-slime maintainers would welcome the addition of these two commands? If they do, then I'll wait and see if it's merged with vim-slime first.

gerazov commented 3 years ago

Yeah let's see how it goes for now. But the original PR should be changed to EditCell for vim-ipython-cell I think.

To solve all of this we need to figure out how to send a Ctrl + Shift + V via SlimeSend :thinking:

hanschen commented 3 years ago

Yeah let's see how it goes for now. But the original PR should be changed to EditCell for vim-ipython-cell I think.

Yes, that sounds good.

To solve all of this we need to figure out how to send a Ctrl + Shift + V via SlimeSend thinking

I don't quite get what you're trying to achieve. First, to use %paste instead of %cpaste, as you suggested in https://github.com/jpalardy/vim-slime/issues/293, would require you to copy the code you want to send over to the clipboard, which is exactly what vim-ipython-cell does. I personally don't think it's within the scope of vim-slime (which focuses on sending text). Second, why use Ctrl + Shift + V? Isn't that a terminal-specific shortcut?

It would make more sense to me to go with your current implementation and try to solve the indentation issue. Can you give me an example of when indentation breaks for your implementation?

hanschen commented 3 years ago

I'll close this pull request for now, feel free to re-open if there's any new activity.