
What a code editor does that Notepad does not
Notepad shows every character in the same color and leaves the indentation to you. A code editor reads the text as code. Keywords, strings and comments get their own colors, so a missing quote stands out at once. Press Enter and the new line keeps the indentation of the line above. Put the cursor next to a bracket and its partner lights up. The line numbers match the numbers in error messages.
- Paste or openDrop a file on the page or press Ctrl+O. The language is picked from the file name or from the content.
- EditTab indents, Ctrl+/ comments a line, Ctrl+H finds and replaces, Alt+Up moves a line up.
- SaveCtrl+S saves the file. In Chrome and Edge it writes back into the file you opened.
How syntax highlighting works
The editor does not understand your program. It cuts the text into small pieces called tokens, such as a comment, a string or a keyword, and gives each kind its own color. A string starts at a quote and ends at the next quote that has no backslash before it. So when the rest of a line suddenly turns green, a closing quote is missing. The color is the hint.
Tabs or spaces?
Both work, as long as one file uses only one of them. A tab is one character, and each editor decides how wide to show it: 2, 4 or 8 columns. Spaces look the same everywhere. A file that mixes them lines up on one computer and looks broken on the next.
Beyond that, follow the language. Python's style guide, PEP 8, asks for 4 spaces per level, and Python 3 refuses to run a block that mixes tabs and spaces. Most JavaScript projects use 2 spaces. Go uses tabs, and a Makefile needs a real tab at the start of each command line.
In this editor the Tab key inserts what you chose in Settings: 2 spaces, 4 spaces or a tab. Shift+Tab removes one level.
Line endings: LF and CRLF
The end of a line is a character too. Linux, macOS and the web use one: LF, code 10. Windows uses two: CR then LF, codes 13 and 10.
| System | Line ending | Escape | Codes |
|---|---|---|---|
| Windows | CRLF | \r\n | 13, 10 |
| Linux, macOS, Android, the web | LF | \n | 10 |
| Classic Mac OS, before 2001 | CR | \r | 13 |
Most programs read both. Trouble starts when a shell script saved on Windows runs on Linux. The shell sees the extra CR as part of every command and fails with a strange message. The status bar here shows which kind the opened file had. Click it to switch, and the file is saved that way.
Encodings: UTF-8 and the BOM
Almost every code file today is UTF-8. An English letter takes one byte, é takes two and an emoji takes four. A BOM is three extra bytes that some Windows programs put at the start of a UTF-8 file. You can't see it, but it causes trouble. A PHP file with a BOM sends those bytes to the browser before any header, and many JSON readers reject the file. This editor shows the encoding of an opened file in the status bar and always saves UTF-8 without a BOM.
Keyboard shortcuts
| What it does | Keys |
|---|---|
| Save to a file | Ctrl + S |
| Open a file | Ctrl + O |
| Find, find and replace | Ctrl + F, Ctrl + H |
| All tools | Ctrl + K |
| Indent, outdent | Tab, Shift + Tab (also Ctrl + ] and [) |
| Comment or uncomment the line | Ctrl + / |
| Duplicate the line | Ctrl + D |
| Move the line up or down | Alt + ↑, Alt + ↓ |
| Go to a line | Ctrl + G |
| Leave the editor with the keyboard | Esc, then Tab |
| Undo, redo | Ctrl + Z, Ctrl + Y |
On a Mac, use Cmd instead of Ctrl. Cmd+Option+F opens find and replace. Testing a search pattern? The regex tester shows each match and explains the pattern.
What this editor does not do
It does not run your code, and it does not check it. A missing semicolon or an unknown variable is not flagged, and there is no autocomplete. JSON is the one exception: the JSON editor points to each error with its line and a fix. For a web page you want to see while you build it, the HTML editor has a visual side and a preview.