Useful Tips to Make Gedit an Even Better Text Editor

The Gedit text editor in Linux is known for its simplicity of use. In its default form it offers almost all the basic functionality that an ideal text editor should. However, the real strength of Gedit lies in the fact that its feature set can be expanded using plugins.

There’s a plethora of plugins available for Gedit, so it’s almost impossible to know or use each of the available plugins. While some plugins are aimed at a niche audience (say, coders), there are many that can prove useful to end users as well.

In this article we will discuss a couple of plugins (as well as a neat little trick) that, irrespective of the kind of user you are, will make your Gedit experience better. Please note that we’ve tested all the commands and instructions mentioned in this article on Ubuntu 14.04 and Gedit 3.10.4.

1. Search for text in all files in a directory

By default, Gedit’s “Find” feature lets you perform search operations in a single file. What if you want to search for a text/string in all the files present in a particular directory? Worry not, there’s a plugin called File Search that lets you do that.

To install the plugin, first download the Gedit File Search plugin by running the following command:

git clone git://github.com/oliver/gedit-file-search

Note: if git isn’t installed on your system, just run the following command to install it:

sudo apt install git

Once the plugin download is done, unpack the downloaded file and run make command in the extracted directory. Finally, copy the contents of the extracted folder to “/home/your-username/.local/share/gedit/plugins/.”

Now start Gedit, go to “Edit -> Preferences -> Plugins,” and enable “File Search.”

gedit-enable-file-search

Now you can access the plugin by heading to “Search -> Search files…” or by doing a right-click on an opened file and clicking the “Search files for” option.

gedit-file-search-in-action

2. Undo recently-closed tabs

Whether you want to open a tab that you accidentally closed or want to quickly open one of the recently-closed tabs, the Necronomicon plugin is at your service. Here’s how you download, install, and use it.

First, download the plugin’s source code and extract, then copy “necronomicon.py” and “necronomicon.plugin” files into the “/home/your-username/.local/share/gedit/plugins” directory.

Restart Gedit and enable the plugin in the “Edit -> Preferences -> Plugins” tab.

gedit-enable-undo-close-tab

Start accessing the recently closed files by heading to “File -> Recently Closed.”

gedit-undo-close-tab-in-action

3. Enable auto-save feature

I’ve been in situations where I lost my work in Gedit because I was not able to save changes in time. If you’ve also been through similar situations (or fear that you might face one some day) and are looking for a solution to this problem, you’ll be glad to know that there’s a way to enable the auto-save feature in Gedit.

Execute the following command to enable the feature:

gsettings set org.gnome.gedit.preferences.editor auto-save true

The default interval for auto-save is ten minutes. However, you can set this to whatever number of minutes you want using the following command:

gsettings set org.gnome.gedit.preferences.editor auto-save-interval [n]

Replace “[n]” with the number of minutes you want to set. For example, I set the auto-save interval to one minute using the following command:

gsettings set org.gnome.gedit.preferences.editor auto-save-interval 1

If the command line is not your cup of tea, you can make all the above-mentioned changes using the Dconf-Editor. If the editor isn’t installed on your system, you can install it using the Ubuntu Software Center application.

Once the editor is there, you can launch it through Dash and head to the “org.gnome.gedit.preferences.editor” element. Here you can turn on the auto-save feature as well as edit the auto-save-interval variable (by clicking on the value).

gedit-auto-save-dconf

This way you can enable Gedit to auto-save any changes you make to files that are being edited in the editor.

Conclusion

The plugins discussed here are easy to download and install as well as simple to use. The corresponding projects are hosted on github, so documentation isn’t a problem. The best part is that there’s no learning curve associated. Do give the plugins (as well as the auto-save trick) a try.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.