10 Tweaks to Supercharge Gedit as Code Editor

Gedit is a good text editor. Turn it into a good code editor with these tips, tricks and tweaks.
Warp Terminal

GNOME may have ditched Gedit as the default text editor but it is still a favorite of long-time Linux users.

It is primarily a text editor, but with some tweaks, it can work as a lightweight code editor.

Yeah! Why use VS Code or other dedicated code editors for writing Bash scripts or simple programs in other languages? Gedit saves the day.

I'll share some of my favorite Gedit tips and tricks in this article. While most of the tweaks are beneficial for writing codes, some could be helpful for general text writing as well.

1. Install plugins

Few people don't even know that Gedit has a robust plugin feature. You can install plugins to get additional features.

There are two kinds of plugins:

  • Official Gedit plugins that are accessible from the editor menu
  • Third-party plugins that can be downloaded from the project websites and placed into the plugins directory (discussed below)

The Gedit plugins can be located in /usr/share/gedit/plugins or Β ~/.local/share/gedit/plugins directories.

A manually installed plugin in the local > share > gedit > plugins directory

You can access the available and installed plugins by clicking the Hamburger menu and then opening the Preference window,

Preferences

The Preferences window has the Plugins tab and you can see all the plugins available to you. You can use the checkbox to enable and disable the plugins.

Plugins menu inside Preferences

2. Show file browser in the side panel

If you are working on a project that has multiple files and folders, getting the file browser to see all the available files in the sidebar is quite helpful.

Go to Preferences -> Plugins and enable the File Browser Panel.

File Browser Panel Plugin

After that, click on the hamburger menu at top right and enable the Side Panel View from Menu View -> Side Panel

Now change the side panel view to file browser, if not already.

Change the side pane to show File Browser

3. Embed a terminal

Yes! You can embed a terminal right into the Gedit text editor.

What's the point? Well, if you are writing programs or scripts, an embed terminal helps you run the script and check the code changes right there in the editor.

Embedded Terminal in Gedit

To get this, first install the plugin (for Ubuntu):

sudo apt install gedit-plugin-terminal

Once the plugin is installed, enable it from Preferences->Plugin.

Embedded terminal Plugin

Mow, enable bottom panel from hamburger menu -> View -> Bottom Panel

Enable the Botto Panel View

4. Markdown preview

Love Markdown? Me too!

There are several Markdown editors available for Linux but you don't have to install another application just to use Markdown.

With the help of a plugin, unsurprisingly called Gedit Markdown Preview, Gedit is perfectly capable of rendering Markdown code.

Arch users can find it in the AUR as gedit-plugin-markdown_preview package.

Other Linux users can find the installation instructions on the project webpage.

Once it is installed, enable it in plugins. You must enable the side panel view from the hamburger menu --> View > Side panel

Enable Side Panel

With that, it starts showing rendered text for Markdown text in the side or bottom pane.

Markdown Preview in Gedit

5. Create snippets

Good coders code. Better coders reuse.

If you find yourself reusing same piece of code or text, you can save it as snippet and insert it when needed. This will save you some time (and frustration).

Enable the Snippet plugin first.

Enable Snippet Plugin

Now you can access the snippets from Hamburger Menu -> Manage Snippets

Manage Snippet Option

You'll find that it already has several snippets added for various programming languages.

A pre-created CPP Main snippet.

You can also add your snippets in the desired folder by clicking the + sign on the bottom left. You may also assign a shortcut key to snippets to insert them even more quickly.

A manually created snippet for Markdown Table.

For example, I added a new snippet for adding a Markdown table and assigned a keyboard shortcut and tab trigger to it (as seen in the above image). Now, if I press CTRL + Alt + S in a Markdown document, a table is added. Alternatively, typing table and pressing the TAB key also adds the Markdown table.

πŸ’‘
Usually, the snippets are saved in /usr/share/gedit/plugins/snippet folder as XM docs, but I could not find where the newly added snippets are saved.

6. Fix the dark mode problem

Coders love dark mode. Gedit adheres to the system theme, and if you switch to dark mode at the OS level, it also switches to dark mode.

The one major problem is that you cannot read anything on the currently selected line because both text and line highlights are white colored.

Text not visible because of line highlight

There is no fix for this. However, a workaround is to either disable highlighting the current line or use a different color scheme.I prefer choosing a different color scheme.

Go to Preferences -> Font & Colors and then select a dark color scheme like Oblivion. It will change the color scheme a little but at least you will be able to see the text on the highlighted lines.

Colour scheme is changed to make the text visible under highlight line

7. Quick highlight selected text

Double-click a word and Gedit highlights all the occurrences of the same word in the entire document.

Words are automatically highlighted when one instance is selected

This feature is not enabled by default though an official plugin is available.

Go to Preferences -> Plugins and enable the Quick Highlight option.

Quick highlight default plugin in Preferences > Plugins

8. Show line numbers

Many code editors show the line numbers by default. It helps you quickly go to the line when you see a 'syntax error at line X'.

You can enable line numbers by going to Preferences -> View -> Display Line Numbers:

Enable Line numbers in Gedit

You may also enable or disable it from the bottom.

Enable Line Numbers from the bottom options

9. Save a version

If you are modifying a file, perhaps it would be better to create a backup copy? Gedit can do this automatically.

Enable this feature in preferences -> Editor -> Create a Backup copy.

Create Backup copy before saving setting in Preferences

A file with the name of the original file appended with a ~ symbol will appear as the backup file.

Backup File in File Manager

10. Autosave files

Since we are talking about versions and backups, how about enabling autosave in Gedit? This way, if you are working on a document and forgot to save it using Ctrl+S manually, the changes get saved automatically.

🚧
This feature does NOT work on a completely new document that has never been saved on the disk.

From Preferences -> Editor, you can enable the Autosave feature. By default, it autosaves every 10 minutes but you can change the duration to your liking.

Autosave after every specified time limit (default)

There is also a third-party smart-auto-save extension that autosaves the document as soon as you stop typing it.

Smart autosave plugin, that saves the document once typing is stopped 

Know more Gedit tricks?

If you want, you can also change the Gedit theme.

Install and Use Additional Gedit Color Themes
Don’t like the default looks for the Gedit text editor? You can surely try to change the color themes. Here’s how to do that.

One of the joys of using any piece of software is discovering it's not-so-obvious features. We have covered such application-specific tweaks in the past. Take a look at Nautilus tips:

13 Ways to Tweak Nautilus File Manager in Linux to Get More Out of it
Nautilus is GNOME’s default file manager application, and you may have seen it in many Linux distributions. It’s a good file manager with plenty of features. However, you can enhance your experience by employing some tweaks and tips. I am going to share such tips and tweaks in

Or, the Flatpak tips and tweaks:

6 Tips and Tools to Enhance Your Flatpak Experience in Linux
If you love using Flatpak applications, here are a few tips, tools, and tweaks to make your Flatpak experience better and smoother.

Which Gedit tweaks you liked the most here? Do you know a killer Gedit feature that not many people are aware of? Share it with us in the comments?

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries πŸ•΅οΈβ€β™‚οΈ

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.