| 📦 Turbo Rust 713ea5c k33g yesterday | 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 Rust 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-rust/settings.toml`, filled in with the theme you are using right now, and opens it for editing — coloured, because Turbo Rust colours TOML: |
| 10 | |
| 11 | ```toml |
| 12 | # turbo-rust project settings. |
| 13 | # |
| 14 | # These apply to everyone who opens this project in turbo-rust. 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-rust -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-rust/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.rs` 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-rust -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-rust -theme turbo-dark main.rs |
| 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 | |
| 📦 Turbo Rust f69efbe k33g 3h ago | 73 | ## Start from a shared configuration |
| 74 | |
| 75 | A team can keep ready-made configurations in a repository — one directory per kind of project, each with a `.turbo-rust` inside. Point the editor at the directory, with the URL the browser shows, and it copies that `.turbo-rust` into the current directory: |
| 76 | |
| 77 | ```bash |
| 78 | cd my-project |
| 79 | turbo-rust -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init |
| 80 | ``` |
| 81 | |
| 82 | It prints what arrived and exits; the next `turbo-rust` opens the project with those settings, snippets and tools in force. The URL may be on rickub, GitHub, GitLab or Codeberg, and may point at the directory, at the `.turbo-rust` inside it, or at the repository itself for its root on the default branch. `git` must be installed: the fetch is a shallow clone. |
| 83 | |
| 84 | A project that already has a `.turbo-rust` is left alone — the editor refuses rather than overwrite what the project decided. Move the directory away first if you mean to replace it. |
| 85 | |
| 📦 Turbo Rust 713ea5c k33g yesterday | 86 | ## Variants |
| 87 | |
| 88 | - **You start the editor from a subdirectory.** The settings are not found: only `./.turbo-rust` is looked at, with no walk up towards the project root. Start from the project's own directory, or pass `-theme` for that run. |
| 89 | - **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. |
| 90 | - **You share the project.** `.turbo-rust/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. |
| 91 | |
| 92 | ## See also |
| 93 | |
| 94 | - Every key, with its type and default: [Project settings reference](../reference/project-settings.md) |
| 95 | - Why the file is not searched for in parent directories, and why autosave waits: [Project settings](../explanation/project-settings.md) |
| 96 | - Writing a theme to pin: [How to write your own theme](write-a-theme.md) |