10 modifications to Supercharge Gedit as a code editor


GNOME may have ditched Gedit as the default text editor but it’s still a longtime favorite of Linux users.

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

Yes! Why use VS Code or other dedicated code editors to write Bash scripts or simple programs in other languages? Gedit saves the day.

I’m going to share some of my favorite Gedit tips and tricks in this article. While most mods are useful for writing code, some of them may be useful for writing general scripts as well.

1. Install plugins

Few people don’t even know that Gedit has a powerful plugin feature. You can install plug-ins to get additional features.

There are two plug-ins:

  • Official Gedit plugins which can be accessed from the editor menu
  • Third-party plug-ins that can be downloaded from project sites and placed in the plug-ins directory (discussed below)

Additional Gedit plugins can be located at /usr/share/gedit/plugins or ~/.local/share/gedit/plugins directories.

Manually installed plugin in the Local> share> gedit> plugins directory

You can access available and installed plug-ins by clicking on the Hamburger menu and then opening the Preferences window,

Preferences

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

List of plugins within Preferences

2. Display the file browser in the side panel

If you are working on a project with multiple files and folders, having the file browser to see all available files in the sidebar is very useful.

go to Preferences -> Plugins and empowerment File browser panel.

File browser panel plugin

Next, tap on the hamburger menu at the top right and enable side panel view from the menu View -> Side panel

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

Change the side pane to show the file browser

3. Embed terminal

Yes! You can include a terminal directly in the Gedit text editor.

what is the point? Well, if you are writing programs or scripts, the include station helps you to run the script and check the code changes there in the editor.

Terminal included with 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 the bottom panel of the hamburger menu -> View -> bottom panel

Enable bottom panel display

4. Markdown Preview

Love Markdown? Me too!

There are many Markdown editors available for Linux but you don’t have to install another app just to use Markdown.

With the help of the plugin, it is not surprising that it is called Gedit Markdown PreviewGedit is fully 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 web page.

Once it is installed, enable it in the plugins. You have to enable side panel view from hamburger menu -> view-> side panel

Enable the side panel

With that, it starts displaying the text displayed for the Markdown text in the side or bottom pane.

Markdown preview in Gedit

5. Create snippets

Good programmers code. Reuse the best programmers.

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

Enable the Snippet plugin first.

Activate the Snippet plugin

Now you can access extracts from Hamburger menu -> clip management

Snippet option management

You will find that it already contains several snippets added for various programming languages.

Pre-generated CPP master snippet.

You can also add your excerpts in the desired folder by clicking on the + sign at the bottom left. You can also set a hotkey for excerpts to enter them more quickly.

Manually generated snippet of Markdown table.

For example, I added a new snippet for Add Markdown table And assign a keyboard shortcut and tab to it (as shown in the image above). Now, if you press CTRL + Alt + S In a Markdown document, a table is added. Instead, write table Pressing the TAB key also adds a Markdown table.

💡

Usually, snippets are saved in /usr/share/gedit/plugins/snippet folder as XM Documents, but I couldn’t find where the newly added snippets were saved.

6. Fixed the dark mode issue

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

The only major problem is that you can’t read anything on the currently selected line because both the text and line highlight are white.

The text is not visible due to the font highlighting

There is no solution to this. However, the workaround is to either disable current font highlighting or use a different color scheme, I’d prefer to choose a different color scheme.

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

Changed the color scheme to make the text visible under the highlight line

7. Quick highlight selected text

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

Words are automatically highlighted when a single instance is selected

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

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

Quick highlight The default plugin is in Preferences > Plugins

8. Show line numbers

Many code editors display line numbers by default. It helps you quickly jump to the line when you see “Syntax error on line X”.

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

Enable line numbers in Gedit

You can also enable or disable it from below.

Enable line numbers from the bottom options

9. Save a copy

If you are modifying a file, maybe it would be a good idea to create a backup? Gedit can do this automatically.

Enable this feature in Preferences -> Editor -> Create Backup.

Create a backup before saving the setting in Preferences

A file with the original file name attached to the ~ The icon will appear as a backup file.

Backup file in File Manager

10. Autosave files

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

🚧

This feature does not work on a completely new document that was never saved to disk.

from Preferences -> EditorYou can enable the autosave feature. By default, it is automatically saved every 10 minutes but you can change the duration as per your liking.

Autosave after every specified time limit (default)

There is also a third party Smart autosave extension It saves the document automatically as soon as you stop typing it.

Smart autosave plugin, which saves your document as soon as you stop typing

Learn more about Gedit tricks?

It is a pleasure to use any part of the program to discover its unobvious features.

We’ve covered such app tweaks in the past. Take a look at Nautilus tips:

13 ways to tweak the 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 is a good file manager with a lot of features. However, you can improve your experience by using some tweaks and tips. I will share these tips and mods at

or the Flatpak Tips and Mods:

6 tips and tools to improve your Flatpak experience in Linux

If you love using Flatpak apps, here are some tips, tools, and tweaks to make your Flatpak experience even better and smoother.

Which Gedit mod do you like the most here? Do you know Gedit’s killer feature that not many people know about? Share it with us in the comments?



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *