Blame platform-demos/C/set-up-gedit.js.page

Packit 1470ea
Packit 1470ea
Packit 1470ea
      xmlns:its="http://www.w3.org/2005/11/its"
Packit 1470ea
      xmlns:xi="http://www.w3.org/2001/XInclude"
Packit 1470ea
      type="topic" style="task"
Packit 1470ea
      id="set-up-gedit.js">
Packit 1470ea
  <info>
Packit 1470ea
    <link type="guide" xref="beginner.js#tutorials"/>
Packit 1470ea
    <revision version="0.1" date="2012-07-17" status="draft"/>
Packit 1470ea
Packit 1470ea
    <credit type="author copyright">
Packit 1470ea
      <name>Taryn Fox</name>
Packit 1470ea
      <email its:translate="no">jewelfox@fursona.net</email>
Packit 1470ea
      <years>2012</years>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
  <title>Set up gedit for JavaScript development</title>
Packit 1470ea
  

This tutorial will show you how to set up <link href="http://projects.gnome.org/gedit/">gedit</link>, GNOME's basic text editor, so that it has a handful of extra features which are useful for writing JavaScript code.

Packit 1470ea
Packit 1470ea
  <section id="view">
Packit 1470ea
    <title>Making code clearer</title>
Packit 1470ea
    

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

Packit 1470ea
    <media type="image" mime="image/png" src="media/geditview.png"/>
Packit 1470ea
    

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

Packit 1470ea
    <steps>
Packit 1470ea
      <item>

<gui>Display line numbers</gui> 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.

</item>
Packit 1470ea
      <item>

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

</item>
Packit 1470ea
      <item>

<gui>Highlight matching brackets</gui> helps you make sure you didn't leave out a bracket by accident.

</item>
Packit 1470ea
    </steps>
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
  <section id="edit">
Packit 1470ea
    <title>Making editing easier</title>
Packit 1470ea
    

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

Packit 1470ea
    <media type="image" mime="image/png" src="media/gediteditor.png"/>
Packit 1470ea
    

Here, you want to have <gui>Enable automatic indentation</gui> turned on. This means that when you hit <key>Enter</key> 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.

Packit 1470ea
    <note style="tip">

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

</note>
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
Packit 1470ea
Packit 1470ea
Packit 1470ea
Packit 1470ea
Packit 1470ea
</page>