Set up gedit for JavaScript development

This tutorial will show you how to set up gedit, GNOME's basic text editor, so that it has a handful of extra features which are useful for writing JavaScript code.

Making code clearer

Click on Edit in gedit's menu bar, then click on Preferences. You should see something like this:

Here are the options you want to make sure are turned on.

  1. Display line numbers will help you compare the code you type in with the original, and make it easier to see which line is causing an error if there is a bug.

  2. Highlight current line makes it easier to see which line you're on, when you have to go back and forth a lot.

  3. Highlight matching brackets helps you make sure you didn't leave out a bracket by accident.

Making editing easier

In gedit's Preferences dialog, click on the Editor tab. You should see something like this:

Here, you want to have Enable automatic indentation turned on. This means that when you hit Enter the cursor stays indented as far as the last line was. This is extremely useful when writing JavaScript code, since it uses indentation to make it clearer which parts do what.

If you want to share code with other people who write GNOME JavaScript applications, you'll also want to set Tab width to 4 and turn on Insert spaces instead of tabs.