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

Add IPy-RunRegister #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add IPy-RunRegister #53

wants to merge 2 commits into from

Conversation

JohnReid
Copy link
Contributor

Hi,

This is another PR to add a function that runs some python code. This time it is IPy-RunRegister that runs the contents of the default register. I find that visually selecting lines and using IPy-Run is not the most efficient as it moves the cursor. With IPy-RunRegister I can quickly yank parts of my code using text objects or motion commands without moving the cursor and run them efficiently.

A word of warning. I am no expert in vimscript but I think I did the mapping and all the rest of it the right way. I also fixed a few typos and add a note in the README.

Thanks again for a great plugin :)

@bfredl
Copy link
Owner

bfredl commented Mar 20, 2020

Hmm we probably want to do this using 'operatorfunc' for this. I have some old code for this, maybe if I will look into it in the weekend (if I don't get distracted :P).

@bfredl
Copy link
Owner

bfredl commented Mar 21, 2020

I added <Plug>(IPy-RunOp) (finally), will it cover your usecase?

@JohnReid
Copy link
Contributor Author

I can't seem to get it to work with text objects but it is working fine for motions.

E.g. if I go to the top of two paragraphs execute IPy-RunOp followed by '2}' IPython executes the 2 paragraphs

But if I am inside the two identically indented paragraphs and I do IPy-RunOp then 'ii' (an indent text-object) it does not execute the two paragraphs. However 'yii' does yank them.

The motions are enough for me but I wonder what is wrong with the text-objects.

@bfredl
Copy link
Owner

bfredl commented Mar 22, 2020

Hmm it seems we need to handle line-wise text objects manually

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

Successfully merging this pull request may close these issues.

2 participants