|
| 1 | +# Setting up an editor for programming |
| 2 | + |
| 3 | +Python comes with its IDLE, and you can use it in this tutorial. If you |
| 4 | +don't like using it for some reason, you need |
| 5 | +[PowerShell, command prompt or terminal](installing-python.md) for |
| 6 | +trying out things. You also need an editor for writing code that will |
| 7 | +be stored in files. |
| 8 | + |
| 9 | +If you use IDLE as your editor, it comes with everything set up for you |
| 10 | +and you can get started right away. If you are going to use some other |
| 11 | +editor, you may need to set |
| 12 | + |
| 13 | +## Automatic tab expanding |
| 14 | + |
| 15 | +This is important. Never use tabs in Python. Nobody else is using tabs, |
| 16 | +and the official style guide tells you to never use tabs. |
| 17 | + |
| 18 | +However, **you don't need to press the spacebar four times every time |
| 19 | +you want to indent**. Your editor should give you four spaces when you |
| 20 | +hit the tab key. Your editor should also remove four spaces when you |
| 21 | +hit backspace and there are four spaces before the cursor. |
| 22 | + |
| 23 | +#### Geany |
| 24 | + |
| 25 | +1. Create a file called `hello.py`, and open it in geany. Or create a |
| 26 | + file in geany and save it as `hello.py`. |
| 27 | +2. Go to Edit at the top and select Preferences. |
| 28 | +3. Go to Editor at left. |
| 29 | +4. Go to Indenting at top. |
| 30 | +5. Select spaces instead of tabs. |
| 31 | + |
| 32 | +## Syntax highlighting |
| 33 | + |
| 34 | +If you type a keyword, like `if`, it should show up with a different |
| 35 | +color than the rest of your text. `"Strings"`, `# comments` and |
| 36 | +everything else should also have their own colors. This makes it much |
| 37 | +easier to write code. |
| 38 | + |
| 39 | +#### Geany |
| 40 | + |
| 41 | +Geany has syntax highlighting by default. You can also install more |
| 42 | +[color schemes](https://www.geany.org/Download/Extras#colors) if you |
| 43 | +don't like the default colorsm and change the color scheme by clicking |
| 44 | +View, then Change Color Scheme. |
| 45 | + |
| 46 | +## Plugins |
| 47 | + |
| 48 | +Advanced editors support plugins. You may find some of them useful. |
| 49 | + |
| 50 | +#### Geany |
| 51 | + |
| 52 | +On Debian-based GNU/Linux distributions, install the geany-plugins |
| 53 | +package. See [the Geany website](https://plugins.geany.org/) for |
| 54 | +instructions for other platforms. |
0 commit comments