Gedit, the official text editor for GNOME desktop environment, is pretty light and simple to use. However, it has much more to offer with the use of various available plug-ins. In this article, we will learn about a few gedit plug-ins that can be really helpful to programmers.
Being an active programmer, the most useful gedit plug-in to me has been the File browser. While coding or debugging, we definitely don’t want to manage the opened tabs or even re-open a file again and again.
As this plug-in comes with the default installation of gedit, one can bring it up by key ‘F9’ or through the menu option:
View -> Side Panel
This is how it looks like:
As you can see, the left panel lists all the opened files and highlights the file which is being currently worked on. This plug-in becomes extremely useful while working with a huge set of files.
Besides, if you open the other tab in this Side Panel (check the bottom of the panel to switch tab), it is the panel where one can browse the files and directories in file system.
One can browse the sources in the file system or even search a file to open a new file to edit.
This is not a default plug-in. The Linux command line tab-completion feature (for file and directory names) has helped many in reducing typing efforts. The same way, gedit comes with this feature for frequently used code snippets and keywords. The plug-in as a part of gedit-plugins package. So, install the package first :
$ sudo apt-get install gedit-plugins
This installs all the plug-ins, though to enable one, set it from the gedit preferences. Therefore, in the gedit, go to the following menu option:
Edit -> preferences
Go to tab “Plugins” tab, scroll to ‘Snippets’, check it to enable auto-insertion and then click on ‘close’.
Since gedit knows we are writing a C/C++ file through its extension, it will set the syntax highlighting to C/C++. Notice the bottom-most row of the gedit. One can even change it from there itself. Any ways, to add a new class now, just type “class” and press ‘Tab’, here is what I get
It has auto-inserted the complete class structure. Though class name and other data members are left to be customized. It definitely saves a lot of time.
We can also set what all snippets we want to auto-insert while coding. Therefore go to
Tools > Manage Snippets...
For example, to add a new ‘Global’ snippet, press the ‘+’ sign in the Snippet Manager located at bottom-left of the Side Panel in the window. In the Edit panel, add the text shown in snapshot below :
To auto-insert it using a short-cut, just click in the input box in front of the ‘Shortcut key’, and press your desired short-cut key. I pressed ‘Shift + Ctrl + C’, and it automatically populates the input box with it. Press close, and you are done. Now, to auto-insert the global code snippet, just press keys ‘Shift + Ctrl +C’.
I have always enjoyed this plug-in as it saves on a lot of typing be in frequently used keywords or code snippets.
Code Comment is an external plug-in. It allows us to comment or uncomment a block of code conveniently. This plug-in also comes as a part of gedit-plugins package, if not yet installed :
$ sudo apt-get install gedit-plugins
To enable it, goto
Edit > preferencesTab: Plugins
Scroll to ‘Code Comment’, tick the check-box, as shown in the snapshot, and then press ‘close’.
Now, for commenting a block of code, select it and press ‘Ctrl + M’. To uncomment a selected block of code, use the key combination ‘Ctrl + Shift + M’.
As one can see, there are multiple plug-ins gedit offers, we just need to explore them and select them as per our gedit usage. Certain plug-ins are even specific to the coding language. It all depends, what we need and that is why these are plug-ins but not default features.
Interested in more? Read our article on Imitation – A Gedit Plugin To Edit A Document Simultaneously At Multiple Places.
Which gedit plug-ins you use frequently? Share your experiences with us.
联系客服