# Opening and saving documents

Each Mayhap window holds one document, with its name at the top left. A document is saved as a .mayhap file, which keeps everything you write in it, and Mayhap opens Markdown, plain text and Word documents too. By default Mayhap saves when you ask, while it keeps a recovery copy of unsaved changes in the background.

## Starting a new document

To start a new document, press `Ctrl+N / ⌘N`. It opens in a window of its own, called *Untitled* until you save it. The document's name sits at the top left of the window, after a dot while it has unsaved changes.

A click on the name opens the file menu: *New document*, *Open…*, *Save*, *Save As…*, *Rename…* and the rest, each with its key. At its foot are the page's words and characters. `Alt+F` opens the menu too on Linux and Windows; on a Mac, the same commands are also in the menu bar's *File* menu.

![The file menu open under the document's name, each command with its key and the page's words and characters at its foot](https://mayhap.app/build/assets/file-menu-fqS3UHe1.webp)

## Saving a document

To save, press `Ctrl+S / ⌘S` or choose *Save* in the file menu. The first time, Mayhap asks where, starting in your documents folder, and saves a *.mayhap* file. A *.mayhap* file keeps the whole document: the page, every version, its maybes and Aside.

If you would like to save the document under another name or in another folder, choose *Save As…* or press `Ctrl+Shift+S / ⇧⌘S`. When you close a window or quit with unsaved changes, Mayhap asks first: *Save*, *Don't Save* or *Cancel*.

## Saving automatically

By default, Mayhap saves only when you ask. If you would like it to save for you, turn on *Save automatically* in *Settings › Writing*. A document with a name is then saved a second after you stop typing, when you switch to another window, and when you close it or quit, without asking.

A new document still asks where to go the first time you save or close it. Likewise, *Save automatically* never answers a question for you: a Markdown file that can't keep what you added, or a file another app changed, waits with its dot until you choose.

## The documents folder

The documents folder is where the first save of a new document starts: a *Mayhap* folder in your system's documents folder, made the first time it's needed. Once a document has a file, its own folder takes that role. The Open list searches the documents folder too, so it's a convenient place to keep everything you write.

To use another folder, open *Settings › Writing* and click *Change…* beside *Documents folder*.

## Opening a document

To open a document, press `Ctrl+O / ⌘O`. The Open list drops down under the document's name, with a search field at its top. With nothing typed, it shows the documents in the current document's folder, newest change first, then your books, then *Recent*. At its end, *Browse…* opens your system's file dialog.

![The Open list under the document's name: the documents in its folder, then the book The Harbour Year with its four chapters](https://mayhap.app/build/assets/open-list-U-H794v7.webp)

Type any part of a name to search every *.mayhap*, *.md*, *.txt* and *.docx* file in your documents folder, in the current document's folder and among your recent files. For example, typing *harb year* finds *The Harbour Year.mayhap*. Press `↑` or `↓` to pick a document and `Return` to open it, or `Esc` to close the list.

A document picked in the list opens in this window, in place of the one here; if that one has unsaved changes, Mayhap asks about them first. If you would like the document in a window of its own, press `Ctrl+Return / ⌘Return`, or hold `Ctrl / ⌘` as you click it. A document already open in another window just comes to the front.

## Recent files

*Recent* in the Open list holds the documents you opened or saved lately that the folder above it doesn't show, each with its folder. `Ctrl+Shift+O / ⇧⌘O` opens the Open list too.

A recent file that has gone since shows *missing*. To take it off the list, click its ×, or pick it and press `Delete` with nothing typed.

## Markdown and plain-text files

Mayhap opens *.md* and *.txt* files as well. The text becomes the page, Markdown as the page's own formatting, and the window keeps the file's name with its extension. When you save, Mayhap writes the text back in the same format.

However, a Markdown or plain-text file can't hold versions, maybes or Aside. If the document has any of them when you save, Mayhap asks, for example: *notes.md can't keep alternatives, maybes or Aside.*

Save as .mayhap…
: Saves the whole document as a new *.mayhap* file and leaves *notes.md* as it was.

Save Markdown only
: Writes the page to *notes.md* with the versions shown, leaving out the maybes and Aside.

Cancel
: Saves nothing.

Word documents open too, as new documents of their own. You can learn more about this in [Word documents](https://mayhap.app/guide/word-documents).

## Renaming a document

To rename the file of the document you're in, choose *Rename…* in the file menu. The name at the top left becomes a field; type the new name and press `Return`. Mayhap renames the file in its folder and keeps its extension, and the recent files follow the new name. `Esc` leaves the name as it was.

If another file in the folder has that name, Mayhap says so after the name, and the field stays open for another try.

## When the file changes on disk

Mayhap watches the file of the open document. If another app or a sync service changes it, *Changed on disk* shows after the name, with *Reload*, which opens the file as it is now. If you have unsaved changes, *Keep mine* is beside it: it keeps the text in the window, and your next save writes it over the file.

Until you choose, saving writes nothing over the file. If the file is deleted or moved away, the document stays open with its dot showing, and saving writes the file back.

## Reopening documents at the next start

When you quit, Mayhap remembers the windows that are open: each one's document, caret, scroll, side panels and place on the screen. The next time you start Mayhap, it opens them again. Windows of documents that were never saved aren't reopened.

If you'd rather start with a new document each time, turn off *Reopen the documents open at quit* in *Settings › Writing*.

## Recovering after a crash

While a document has unsaved changes, Mayhap writes a recovery copy of it every few seconds. If Mayhap or the computer closes unexpectedly, the next start opens each recovered document as an unsaved document that says *Recovered — save to keep it*. Save it to keep it, or close it without saving to let it go.

That start also says *Mayhap closed unexpectedly last time.* with *Report…*. A click opens your mail app on a report to support@mayhap.app, with details of the crash and nothing of your text.

## Keys

| Command | Linux, Windows | macOS |
| --- | --- | --- |
| New document | Ctrl+N | ⌘N |
| Open… | Ctrl+O | ⌘O |
| Recent files | Ctrl+Shift+O | ⇧⌘O |
| Open in a window of its own, in the Open list | Ctrl+Return | ⌘Return |
| Save | Ctrl+S | ⌘S |
| Save As… | Ctrl+Shift+S | ⇧⌘S |
| Close the window | Ctrl+W | ⌘W |
| Quit | Ctrl+Q | ⌘Q |
