Usecase:
I write/copy paste lot of snippets that needs to be evaluated in REPL . For example the second answer to this questions http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python .
Problem:
I can do this by copy paste or loading the entire file in REPL but its an overhead sometimes .
Solution ?
What is the simplest way to pass a visual region to a repl in an interactive manner ?
I came across http://stackoverflow.com/questions/7906858/vim-run-selected-code-in-a-persistent-repl-environment.
However what I need is simple way to start a REPL from a VIM Visual selection with stdin as the Visual Input . This sounds way to trivial to be NOT POSSIBLE . How can the visual buffer can be piped into python with no filtering back or handling the output .
For example
Some Other Code
Class Foo():
pass
Some Other Code
I need to be able to select only Class Foo() and enter the REPL with Foo visible in the namespace of the REPL . I have seen many variants like filter back the output etc . But this is more for learning Python Snippets etc and I prefer writing in VIM as opposed to REPL .
PS This Question Is Actually for Python:
I figured that this will work to get a persistent python REPL with stdin in bash :
python -i <(echo "class Foo(object):pass").
Now I can python python -i <(echo "{HERE}")
I can do a <C-R>* there to get my input but it all seems hack .
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment