Part 2 · Everyday editing / 2.1

Opening, tabs, and saving

Getting files in, moving between tabs, and writing them back safely. This chapter also covers how Erya protects your files: atomic saves, external-change detection, and the three confirmation rows that ask for S / Y / N.

Reading time about 14 min Audience Everyone Prerequisites 1.3 Version v1.0 ・ 2026-08-26
2.1.1

Four ways to open a file

Bring it in from the command line, or fetch it from inside the editor.

MethodHow it behaves
Name it at startuperya a.txt b.txt — one tab per file, starting on the first (see 1.2.5).
Ctrl+O file dialogA directory listing you navigate with the arrow keys; the file you choose opens in a new tab.
Ctrl+N new tabA blank, untitled document; you name it on the first save.
F12 Save AsSaves the current text under a different name. Afterwards the tab follows the new file; the original stays on disk, untouched by this tab.
The same file never opens twice

If the path is already open in a tab, Erya switches to it and says “report.txt is already open in a tab”. That prevents the classic disaster of two tabs each holding half your edits and overwriting each other.

2.1.2

Using the file dialog

Five keys are enough: up, down, in, up a level, cancel.

爾雅 Erya │ Open file │ /home/leo/docs
↑/↓ select Enter/→ open ←/Backspace parent Esc/Q cancel
┌────────────────────────────────────────────┐ │ 📂 .. │ │ 📂 archive │ │▶ 📂 drafts │ │ report.txt │ │ appendix.md │ │ nginx.conf │ └────────────────────────────────────────────┘
/home/leo/docs │ 3/6
↑/↓ select Enter/→ open ←/Backspace parent Esc/Q cancel
KeyWhat it does
↑ ↓Move the selection. The list scrolls when it is taller than the panel.
PageUp PageDownMove a page at a time.
Home EndJump to the top or bottom of the list.
Enter or →Enter a directory, or open a file.
← or BackspaceGo up one level. The directory you just left stays selected.
Esc or QCancel and return to editing.
  • Directories are marked 📂; files have a blank marker, so directories visually group together.
  • Sorting is directories first, then files, each alphabetically and case-insensitively.
  • The .. entry at the top is the parent, the same as ←.
  • The selected row is black on grey with a ▶.
  • The status bar shows the current directory and “which of how many”.
  • The dialog opens in the directory of the current document; for an untitled document, the working directory.
Esc cancels; it does not go up

This differs from most file browsers. Up one level is ← or Backspace; Esc closes the dialog entirely. Erya's Esc means “leave this screen” everywhere, and this screen is no exception (see 1.3.7).

2.1.3

Tabs: new, switch, close

Four keys, and you see the result in row 1.

KeyActionNotes
Ctrl+NNew blank tabCreates an untitled document and switches to it.
F10Next tabWraps around from the last to the first.
F9Previous tabWraps the other way.
F11Close this tabAsks first if there are unsaved changes (see 2.1.8).
Closing the last tab does not exit

Erya always keeps at least one tab. Close the last one and you are left with a fresh untitled document. To leave the program, press Ctrl+X.

On exit, Erya walks through every background tab looking for unsaved changes, switching to each one that has them and asking (S save / Y discard / N return) before it finally quits. “I thought I had saved, but the third tab was not” cannot happen.

2.1.4

What each tab remembers

Almost everything is per tab; two things are shared.

Per tab

  • Cursor and scroll position
  • The selection and its kind
  • Undo and redo history (100 steps each)
  • The last search and replacement text
  • Insert / overwrite mode
  • Line wrap on or off
  • Encoding and line endings
  • Paragraph width

Shared by all tabs

  • The clipboard — copy in tab A, paste in tab B
  • Key profile and interface language — changing them in system settings applies to every tab at once (see 4.2.2)

Phrases and macros live in files; once loaded they apply to the current tab (see 2.4.5).

Moving text between files

Select in file A, Ctrl+C, F10 to file B, Ctrl+V. Erya's clipboard is internal, though — it is not the system clipboard. To exchange text with other applications, use the terminal's own copy and paste (see 2.2.7).

2.1.5

Save and Save As

Ctrl+S writes back; F12 writes somewhere new.

  1. A document with a name: Ctrl+S writes it, the message row says “Saved …”, and the asterisk in row 1 disappears.
  2. An untitled document: Ctrl+S opens the “Save as:” input automatically. Type a name and press Enter. You do not have to remember to press F12 instead.
  3. Save As: F12 pre-fills the current path; edit it and press Enter. Afterwards the tab belongs to the new file.
Enter confirm Esc cancel ←/→ move caret Backspace/Delete edit
Save as: /home/leo/docs/report-backup.txt
  • The input supports ← →, Backspace, and Delete, and scrolls for long paths.
  • An empty name is refused with “Filename cannot be empty”, and it asks again.
  • An existing directory as the target fails with “Cannot save a document as a directory”.
  • Directories in the path must already exist; Erya does not create them.
2.1.6

What actually happens on save

Nothing is written over the original; a temporary file is swapped in.

① Temporary file in the same directory ② Flush really on the disk ③ Rename one atomic step ④ Permissions restored on Unix If any step fails, the original is exactly as it was — there is never a half-written file The temporary file must share the directory, because only then is the rename atomic
Figure 2.1.1 The atomic save. Power loss, a full disk, or a killed process all leave the previous version intact.
  • The temporary file is always in the same directory as the original. So the directory itself must be writable — a writable file in a read-only directory cannot be saved.
  • On Unix the original permissions are preserved. A chmod you applied earlier is not reset, and the executable bit on a script survives.
  • Saving as UTF-8 streams the content in chunks, so large documents are not copied into memory just to be written.
  • The save also carries out any pending encoding and line-ending conversion (see 3.1.2).
2.1.7

When another program changes the file

Erya checks the disk every 250 ms; what happens next depends on whether you have edited.

You have not edited (clean document)

It reloads automatically and says “External update detected; file safely reloaded”. What you see is always the current file.

Typical causes: another window just saved, or git pull replaced the file.

You have edited (unsaved changes)

Nothing of yours is overwritten. The message row warns “The file changed externally; confirmation is required before saving”, and the red confirmation appears when you press Ctrl+S.

Typical cause: you are editing and a colleague saved a version too.

File changed externally: [O]verwrite, [R]eload, [N/Esc] cancel
KeyActionResult
OOverwriteYour version wins. The changes on disk are gone.
RReloadDiscards your edits and reads the file again. What you typed is gone.
N / EscCancelNothing happens. Both versions still exist, so you can save yours elsewhere and deal with it calmly.
When in doubt: N, then F12

Both O and R throw one side away, and neither can be undone. The safe move is N to cancel, F12 to save your version under a new name, and then F4 to merge the two with the comparison view (see 3.4).

An automatic reload clears the undo history

After a clean document is reloaded, the undo and redo history is cleared too — those steps applied to the old content and would do damage if replayed onto the new. It is deliberate, but it startles everyone the first time.

2.1.8

Leaving with unsaved changes

Two situations stop you, both answered with S / Y / N.

Unsaved document: S save and exit / Y discard / N return
Unsaved tab: S save and close / Y discard / N return
KeyWhat it does
SSave first, then exit or close. An unnamed document is asked for a name.
YDiscard the changes and go. Nothing recovers them after this.
N / EscCancel and return to editing.
Y does not mean “yes”; it means “discard”

Answering a question with a reflexive Y is the single easiest way to lose work. In Erya, Y always means “discard changes” — to save, press S. All three confirmations spell out every letter on the same row; read it first.

2.1.9

Common problems

The six that come up most often around opening and saving.

SymptomCause and fix
“Save failed: Permission denied”The file or its directory is not writable. The atomic save needs to create a temporary file in that directory (2.1.6).
“Save failed: No such file or directory”A directory in the path does not exist. Create it first with mkdir -p.
“Cannot save a document as a directory”Save As was given an existing directory. Add a filename.
“Filename cannot be empty”You pressed Enter on an empty input; it simply asks again.
You edited the wrong versionThe file changed externally and you missed the warning. Press N and save a copy (2.1.7).
Undo suddenly does nothingThe document was just reloaded automatically, which clears the history (2.1.7).