|Gedit IPython plugin||
July 01 2012
By Sebastiaan Mathôt 6372 reads
What is Gedit IPython plugin?
Gedit is the default text editor for most Linux distributions. I personally use it to do most of my programming and data analysis.
IPython is an interactive Python shell. Many people prefer to use it over the vanilla Python shell, because it has some nifty tricks like tab-completion of commands, etc.
The Gedit IPython plugin allows you to select text in Gedit and run it straight away in an IPython shell by pressing Control+R. This is very convenient if you quickly want to run short pieces of code. Please note that executing long pieces of code may not work well (see alternatives below).
Download and installation
You can download the source code from GitHub and install it by extracting the source code somewhere and executing the following command as root:
python setup.py install
Ubuntu users can install the plugin directly from the Cogsci.nl PPA:
sudo add-apt-repository ppa:smathot/cogscinl sudo apt-get update sudo apt-get install gedit-plugin-ipython
After you have installed the plugin, enable it in the Gedit preferences (Menu → Edit → Preferences → Plugins → IPython). Next, start ipython-listener in a terminal. This is a simple wrapper around the normal IPython shell that is required for the plugin to work. (i.e. the plugin will not communicate with a normal IPython shell!)
Now you can select a string of code in Gedit and press Control+R to run it in the IPython console! If you have not selected any text, the entire document will be executed.
With Kate, the KDE advanced text editor, you can accomplish much the same thing without the need for additional software. If you enable the "Terminal tool view" plug-in (included by default, at least on Kubuntu), you can open a terminal in the lower pane of the editor window. If you start IPython in this terminal, you can execute selected pieces of code using the Tools → Pipe to terminal function.
Spyder is a MATLAB-like programming environment that works with IPython.