| 📦 Turbo Go 3d7798b k33g 9h ago | 1 | # How to give a project its own settings |
| 2 | |
| 3 | This guide shows how to pin a theme and turn on automatic saving for one project, so everyone who opens it gets the same editor. It assumes you already have Turbo Go installed. |
| 4 | |
| 5 | ## Create the settings file |
| 6 | |
| 7 | Start the editor **from the project's own directory**, then choose **Options ▸ Create project settings**. |
| 8 | |
| 9 | That writes `.turbo-go/settings.toml`, filled in with the theme you are using right now, and opens it for editing — coloured, because Turbo Go colours TOML: |
| 10 | |
| 11 | ```toml |
| 12 | # turbo-go project settings. |
| 13 | # |
| 14 | # These apply to everyone who opens this project in turbo-go. Delete this file |
| 15 | # and the editor falls back to its own defaults. |
| 16 | |
| 17 | [editor] |
| 18 | |
| 19 | # The colour theme to start in. `turbo-go -list-themes` lists them all. |
| 20 | # A -theme flag on the command line overrides this. |
| 21 | theme = "turbo-classic" |
| 22 | |
| 23 | # Write modified files by themselves, a short while after you stop typing. |
| 24 | # On, because a project that has gone to the trouble of having a settings file |
| 25 | # has said what it wants; set it to false and save, and it stops at once. |
| 26 | autosave = true |
| 27 | |
| 28 | # How long that while is. Any Go duration: "500ms", "2s", "1m". |
| 29 | autosave_delay = "2s" |
| 30 | ``` |
| 31 | |
| 32 | The file is read when the editor starts, and **again every time you save it** — so a change is in force the moment you press `F2`. The status bar confirms it: `Applied .turbo-go/settings.toml — autosave on (2s)`. |
| 33 | |
| 34 | That covers the settings this file holds, not the theme: **Options ▸ Theme** is the live way to change that, and writes your choice back here for you. |
| 35 | |
| 36 | The menu item you just used is now greyed out, and **Options ▸ Project settings…** beside it is not. That is the rule for all three of the project's files: you can create the one you have not got, and open the one you have. |
| 37 | |
| 38 | ## Automatic saving |
| 39 | |
| 40 | It is already on: the file you were just given says `autosave = true`. |
| 41 | |
| 42 | Any file with a name is written two seconds after you stop typing. The status bar says `Saved main.go` when it happens. Nothing is written while you are still typing — each keystroke pushes the wait out again. |
| 43 | |
| 44 | Two things change as a consequence, both on purpose: |
| 45 | |
| 46 | - **Closing a window stops asking** whether to save. It was going to be saved anyway. |
| 47 | - **Leaving the editor stops asking** too, for the same reason. |
| 48 | |
| 49 | A file that has never been named is the exception: automatic saving never opens a dialog, so an untitled window keeps its `*` and is still asked about when you close it. |
| 50 | |
| 51 | To turn it off, set `autosave` to `false` and save; the status bar answers `autosave off`, and it stops there and then. To wait longer or less, change `autosave_delay`: |
| 52 | |
| 53 | ```toml |
| 54 | autosave_delay = "500ms" |
| 55 | ``` |
| 56 | |
| 57 | ## Pin the theme |
| 58 | |
| 59 | Set `theme` to any name from `turbo-go -list-themes`, or simply pick one with **Options ▸ Theme** — with a settings file present, choosing a theme writes it into the file for you, keeping your comments and layout as they were. |
| 60 | |
| 61 | ## Try a different theme without changing the file |
| 62 | |
| 63 | Pass `-theme` on the command line. It wins over the project's choice for that run only: |
| 64 | |
| 65 | ```bash |
| 66 | turbo-go -theme turbo-dark main.go |
| 67 | ``` |
| 68 | |
| 69 | ## Edit the file later |
| 70 | |
| 71 | **Options ▸ Project settings…** opens it again. It is greyed out in a project that has none. |
| 72 | |
| 73 | ## Variants |
| 74 | |
| 75 | - **You start the editor from a subdirectory.** The settings are not found: only `./.turbo-go` is looked at, with no walk up towards the project root. Start from the project's own directory, or pass `-theme` for that run. |
| 76 | - **The file has a mistake in it.** The editor says so on standard error and opens with its defaults, so you can fix the file in the editor itself. |
| 77 | - **You share the project.** `.turbo-go/settings.toml` is an ordinary file; commit it to agree on a theme across a team, or add it to `.gitignore` to keep it to yourself. |
| 78 | |
| 79 | ## See also |
| 80 | |
| 81 | - Every key, with its type and default: [Project settings reference](../reference/project-settings.md) |
| 82 | - Why the file is not searched for in parent directories, and why autosave waits: [Project settings](../explanation/project-settings.md) |
| 83 | - Writing a theme to pin: [How to write your own theme](write-a-theme.md) |