Gedit, as most of you would already know, is a popular general purpose text editor. It is the default text editor for Linux distributions that use the GNOME desktop environment. The first thing that attracts anyone to Gedit is its smooth and uncluttered UI. Besides, it’s a lightweight application as well, which is another plus.
Gedit offers almost all the features expected from a basic text editor, but if that’s not enough for some reason, you can add more functionality to it through plugins. There are several Gedit plugins available – to access the complete list, open the Gedit application on your system, and go to Edit->Preferences->Plugins.
Following is the screenshot of the Plugins tab in my Gedit application:
You’ll notice that some of the available plugins are enabled by default, while others aren’t. To enable a plugin, simply click the empty square corresponding to it. Click on an already selected box to disable that plugin.
By default, Gedit doesn’t provide much functionality for programmers, but this can be changed if you install (if required) and enable some useful development related plugins. If you are a software coder who’s looking to make the most of Gedit for development purposes, then look no further, as in this tutorial, we will discuss some really useful programming-related Gedit plugins.
Before we move head, keep in mind that all the instructions as well examples presented in this article have been tested on Ubuntu 14.04LTS and the Gedit version we’ve used is 3.10.4.
Useful development-related Gedit plugins
If you are a Linux command line user, then I am sure you’d be using the auto-complete feature of Bash that – for those who aren’t aware – automatically completes file/directory names once user presses the TAB key after writing the initial few characters of the name.
Not exactly the same way may be, the Snippets plugin in Gedit works on similar lines. Before we delve further, let’s quickly enable the plugin:
Please note that in case there’s no entry for Snippets, then that means the plugin isn’t installed. To install it, run the following command:
sudo apt-get install gedit-plugins
This should install Snippets, as well as several other Gedit plugins. Please note that in case you face problem with the aforementioned command, you will likely get some help by heading here.
Anyway, assuming that the plugin is now installed and activated, you can test it out easily by writing a small piece of code. For example, I wrote the word ‘class’ in a header file in a C++ project, and then pressed TAB. Here’s what the plugin did:
The code template highlighted in the screenshot above was automatically produced, thanks to Snippet. Now that you’ve got a basic idea of what this plugin is capable of, let’s quickly see what Snippets’ official documentation says about the plugin (as you’d be able to better comprehend it now):
“The idea is to allow users to create little tags that expand to a snippet of text,” the document says. “When the tag is entered in the Gedit view and <tab> is pressed, it gets expanded to the snippet. The user can specify insertion points in the snippet so that when <tab> is pressed again, the cursor moves to the next insertion position. It’s very basic and a bit TM alike (though it probably will need some extra features)”
For more information on the plugin, head here.
2. File Browser
One of the basic and very useful functionality that a programming IDE offers is file browser, using which you can easily access or switch between various files of a specific project, or on system in general. Yes, you guessed it right, the file browser functionality can also be added to Gedit through a plugin.
The name of the plugin is File Browser Panel, and the good thing is that you don’t have to explicitly enable it, as it’s activated by default.
So now the question is how to add the side panel to Gedit UI. Well, it’s simple, just click the ‘Side Panel’ option in the ‘View’ menu. You’ll see that the file browser appears towards the left:
Note: To quickly open and close the side panel, you can press the F9 key each time – that’s an easy alternative to going to the Side Panel option in the View menu every time you want to toggle the functionality.
As you can see in the screenshot above, the browser shows the list of files currently opened in the editor. However, if that’s not what you want, you can click the small File Browser icon (that sits just beside the text file icon) at the bottom of the panel, and you’ll get the ability to
browse files kept anywhere on the system:
Whenever you’ll be in a searchable directory, just above those icons at the bottom, there’ll appear a search bar using which you can search for files in that particular directory.
3. Embedded Terminal
Assuming that you’ve installed the Gedit plugin-set using the command that I mentioned while discussing the Snippets plugin, there’s another very useful development-related plugin that you can use: Embedded Terminal.
If you are using Linux as your development platform then it won’t be a stretch to say that the command line terminal would be an indispensible part of your work. And if you are using Gedit as your programming editor, then you’ll be glad to know that you can actually embed a command line terminal in the editor, using the Embedded Terminal plugin mentioned above.
Once the plugin is enabled in the Preferences menu, just go to the View menu and click Bottom Panel option. You’ll see that a command line terminal will appear at the bottom of the editor’s UI in embedded form:
It’s hard to even imagine the amount of time this plugin will save you, especially if most of your work involves the command line.
The three plugins that we discussed here in this tutorial should be enough to give you an idea about how easy it is to expand the feature ambit of Gedit in order to make it more development friendly. If you observe closely, all three plugins – Snippets, File Browser, and Embedded Terminal – can prove to be useful even if you aren’t really a programming freak.
To be clear, this is just the tip of an iceberg, as there are many other development-related plugins available for Gedit. We’ll try to collect a handful of other useful ones, and come up with a part 2 of this tutorial soon.