I just started using Vim for my main IDE, and one of my frequently used functions in the previous IDE is "execute selection in python".
I've learned that there are two ways in executing the code in python,
one is :python3 {expression} and the other one is :w python3
What I want to do is execute selected line(s) of the script in vim without refreshing(closing) the python console.
It looks like :python3 {expression} does not close the python console, so after I used :python3 a=3 , command :python3 print(a) returns proper value 3. However, I think this function does not have a "selection feature" in it. Although :help python shows the [range] argument, but I can't understand how to use it.
On the other hand, the second function has the selection feature (ex. :1,3w !python3) but it seems the python console is refreshed(=closed) everytime I use the function.
I guess adding simple function to .vimrc will do for my purpose but couldn't find one. Any help will be really appreciated!