Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Add IPy-RunRegister#53

Open
JohnReid wants to merge 2 commits intobfredl:masterfrom
JohnReid:master
Open

Add IPy-RunRegister#53
JohnReid wants to merge 2 commits intobfredl:masterfrom
JohnReid:master

Conversation

@JohnReid
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner

bfredl commented Mar 21, 2020

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

@JohnReid
Copy link
Copy Markdown
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
Copy Markdown
Owner

bfredl commented Mar 22, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants