Gedit: No more text-based editor for you!
If you have been reading Ghacks long enough you know I am partial to the Nano text based editor. For many users that editor (or one like it) is all they need. Because of the simplicity of the tools, why slow down your work with a GUI right? But for some, those GUI-less editors are a big turn off. It's like they are the command line equivalent for text editing. Fortunately, for those, there are alternatives to the text-based editor. In the next few articles I will address this by introducing you to some of the better GUI-fied text editors.Â In this particular instance, I will introduce you to the GNOME default editor Gedit.
Although simple to use Gedit does not lack power and features. Gedit features:
- Tools for editing source code as well as mark up languages.
- Offers syntax highlighting.
- Uses tabs so you can have more than one file open at a time in the same window.
- Can edit remote files.
- Full undo/redo support.
- Has a flexible plugin system.
- And much more.
So Gedit should appeal to just about any type of user - no matter your skill level. So now, let's take a look at this tool.
To fire up Gedit click on Applications > Accessories > Gedit Text Editor which will quickly bring up the Gedit main window (see Figure 1). You will notice Gedit looks like your standard text editor. And with this "standard-type" text editor you could easily open any configuration file (some you will need root or sudo access in order to open). Say, for instance, you wanted to edit you wanted to edit your /etc/samba/smb.conf file with this editor. To do this you would have to open Gedit from command like so:
sudo gedit /etc/samba/smb.conf
The above command would allow you to enter your sudo password so you could have read AND write access to the smb.conf file. When you open such a file in Gedit, it will look like what you see in Figure 2. Using this tool will allow you to easily search the file (without using a command like grep) undo/redo any mistakes, easily copy/paste, and more.
But what of that syntax highlighting? You do not get to see it in action when editing a flat .conf file. Let's take a look at a bash script using Gedit.
Yes, that's correct, Gedit even does syntax highlighting for scripting. Figure 2 shows a very simple script (one that creates my .sig file for email) open using syntax highlighting for sh scripting. Â When you open this file, if the syntax highlighting does not appear by default (or if you want to switch the highlighting style) you can turn it on by clicking View > Highlight Mode > Scripts > sh. If you click on View > Highlight Mode you will see the number of different types of modes available.
If you look at the Tools menu you will also notice Gedit offers a spell check, language set option, and document statistics. Finally, if you click on Edit > Preferences > Plugins you will see the available plugins for Gedit. By default Gedit ships with twelve plugins, not all of which are activated. If you want more you can search your package management system (such as Synaptic) for "gedit" (no quotes) and find more available plugins for installation.
If you are one that prefers not to use text-based editors, and you use the GNOME desktop, Gedit might be just the tool for you. In the next article I will introduce you to the KDE equivalent Kate.Advertisement