Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim for python and R scripting (in Screen or not)

I've been trying to find this information online but I'm not getting the answer.

I've used RStudio and Geany for editing files before. Now I'm trying to use ViM to edit python and R files (I know there's RPy, but nothing to do with my problem).

I would like to know how can I have 3 terminals (could also be vim buffers, or screen windows) with one running ViM and the others running R and Python. When I execute a Python script, the terminal (window or buffer) with python shows the output. The same when I run R scripts.

I would appreciate insight on this as this is something that's keeping me from using ViM regularly. I would also consider a solution with terminator terminal multiplexer or guake terminal. Any information about sending code for scripting from one instance to another is welcome.

like image 931
fioghual Avatar asked Mar 03 '12 19:03

fioghual


People also ask

Is vim good for Python programming?

Vim is an awesome text editor that can be used as a Python IDE. For those who use Vim and want to program in Python, here are a few tips on how to do it easily. Vim is a highly extensible text editor. By adding plugins to your .


3 Answers

Are you looking for a way to have a REPL inside Vim? If so, Vim wasn't really designed with that in mind, though there are some plugins that try. Conque is an example.

Some things I use to have a quicker code/run/test iteration with Python:

  • IPython's %edit feature, which starts editing a script with $EDITOR and will run the script after you exit.
  • vim-ipython which can send/execute/recieve code via an IPython interpreter.
  • tmux which allows you to have multiple shells side by side, but with little interaction between them.
like image 75
haesken Avatar answered Oct 28 '22 14:10

haesken


Your requirements for online information may not have been spelled out in enough detail, since I seem to find a wealth of information on using ViM as an IDE for both R and Python:

R:

http://www.r-bloggers.com/r-with-vim/

http://www.vim.org/scripts/script.php?script_id=2628

http://www.vim.org/scripts/script.php?script_id=1048

Python:

http://wiki.python.org/moin/Vim

http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/

http://dancingpenguinsoflight.com/2009/02/python-and-vim-make-your-own-ide/

like image 22
IRTFM Avatar answered Oct 28 '22 13:10

IRTFM


Vim-slime is a general-purpose solution to this I'm pretty happy about, it will send blocks of code to any tmux pane, meaning it works for any language.

https://github.com/jpalardy/vim-slime

like image 37
John McDonnell Avatar answered Oct 28 '22 12:10

John McDonnell