Im from Linux-Ubuntu: Im new at coding, I started to use VIM to code in PYTHON so ===> is there any way I could select a chunk of code and then with execute it in linux terminal and then with an enter return to VIM. Sorry for my english writing
-
looks like you want to make vim your shelldnit13– dnit132016-02-10 20:25:50 +00:00Commented Feb 10, 2016 at 20:25
-
2If you're interested in Vim, do check out Vi and Vim!muru– muru2016-02-10 20:50:07 +00:00Commented Feb 10, 2016 at 20:50
-
1There's also a QuickRun plugin to quickly run selected text or a file with some command: github.com/thinca/vim-quickrun/blob/master/doc/quickrun.txtmuru– muru2016-02-12 20:33:55 +00:00Commented Feb 12, 2016 at 20:33
Add a comment
|
2 Answers
Select the block of text by pressing V and moving around:
Now use :w !python3 (or python, as the case may be):
This calls python3 and passes the selected text to the standard input. So, if your code makes use of stdin, this won't work well. Naturally, this won't get you far. For running entire files, you can use :!python3 % or :!python %.

