Skip to content

Commit 8e6b4a5

Browse files
committed
editor setup
1 parent 2d3c0c1 commit 8e6b4a5

File tree

1 file changed

+81
-18
lines changed

1 file changed

+81
-18
lines changed

editor-setup.md

Lines changed: 81 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ be stored in files.
88

99
If you use IDLE as your editor, it comes with everything set up for you
1010
and you can get started right away. If you are going to use some other
11-
editor, you may need to set
11+
editor, you may need to change some settings to make it suitable for
12+
Python use.
13+
14+
Do **not** use word processors like Microsoft Word and LibreOffice
15+
Write for programming. They create their own files, but you need plain
16+
text files for programming.
17+
18+
Start by creating an empty file called `hello.py` and opening it with
19+
your editor. Or just open your editor and save a file as `hello.py`.
1220

1321
## Automatic tab expanding
1422

@@ -17,17 +25,27 @@ and the official style guide tells you to never use tabs.
1725

1826
However, **you don't need to press the spacebar four times every time
1927
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.
28+
hit the tab key. Some editors also remove four spaces when you hit
29+
backspace and there are four spaces before the cursor.
2230

2331
### Geany
2432

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.
33+
1. Go to *Edit* at the top and select Preferences.
34+
2. Go to *Editor* at left.
35+
2. Go to *Indenting* at top.
36+
4. Select *Spaces* instead of *Tabs*.
37+
38+
### gedit and pluma
39+
40+
1. Go to Edit at the top and select Preferences.
41+
2. Go to Editor at top.
42+
3. Change the indent width to 4 and select *Add spaces instead of tabs*.
43+
44+
### Mousepad
45+
46+
1. Go to *Document* at the top, then *Tab Size*.
47+
2. Select 4.
48+
3. Also select *Insert Spaces*.
3149

3250
## Syntax highlighting
3351

@@ -36,19 +54,64 @@ color than the rest of your text. `"Strings"`, `# comments` and
3654
everything else should also have their own colors. This makes it much
3755
easier to write code.
3856

57+
All the editors below have syntax highlighting by default, but you can
58+
also change the colors if you don't like them.
59+
3960
### Geany
4061

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.
62+
Install more [color schemes](https://www.geany.org/Download/Extras#colors),
63+
then go to *View*, *Change Color Scheme*.
64+
65+
### gedit and pluma
66+
67+
Click *Fonts & Colors* in the preferences and select another color
68+
theme.
69+
70+
### GNU Emacs
71+
72+
Type M-x, type `load-theme`, press Tab twice to see a list of theme
73+
names, then enter a theme name and press Enter. If you want to
74+
automatically change the theme when Emacs starts, add
75+
`(load-theme 'your-theme-name)` to your ~/.emacs file.
76+
77+
### IDLE
4578

46-
## Plugins
79+
Go to *Options*, then *Configure IDLE*, then *Highlighting* at top.
4780

48-
Advanced editors support plugins. You may find some of them useful.
81+
## Is your editor using Python 3?
82+
83+
Some editors allow you to run your programs with a single keypress,
84+
usually by pressing F5. This tutorial is written for Python 3 or newer,
85+
so your editor also needs to run the programs in Python 3 or newer.
86+
87+
If you are unsure which Python your editor runs, create a test file
88+
with the following contents:
89+
90+
```py
91+
import sys
92+
print(sys.version)
93+
```
94+
95+
If the version starts with 2, it's too old.
4996

5097
### Geany
5198

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.
99+
1. Go to *Build*, then *Set Build Commands*.
100+
2. Replace `python` or `python2` with `python3` everywhere.
101+
102+
### GNU Emacs
103+
104+
Usually I write something in Emacs, then I press Ctrl+Z to suspend
105+
Emacs and run the program myself. If you know how to run programs in
106+
Emacs and you'd like to write about it here, [tell me](contact-me.md).
107+
108+
### IDLE
109+
110+
If you [installed IDLE](installing-python.md) correctly, it should use
111+
Python 3.
112+
113+
***
114+
115+
You may use this tutorial freely at your own risk. See [LICENSE](LICENSE).
116+
117+
[Back to the list of contents](README.md)

0 commit comments

Comments
 (0)