Add IPy-RunRegister
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 :)
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).
I added <Plug>(IPy-RunOp) (finally), will it cover your usecase?
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.
Hmm it seems we need to handle line-wise text objects manually