Feature · Find & look inside

Edit text with F4 — built-in editor or your own

F4 edits the file under the cursor in the built-in quick editor or your external editor. Saves keep encoding and line endings, never clobber, and are undoable.

Default shortcut: F4 · Shift+F4 · Ctrl+E · Ctrl+Shift+F4 Updated 15 August 2026 View as Markdown

F4 edits. That is the orthodox verb — Total Commander, Far, Midnight Commander — and in cwdio it means one of two things: the built-in quick editor, which is Quick Look’s edit mode, or the external editor you already use. You pick the default once; the other is always one chord away.

What it does

  • Built-in quick editor. A CodeMirror 6 editor inside the Quick Look overlay: syntax highlighting per language, line numbers, bracket matching, multi-cursor, find/replace (Ctrl+F), go to line (Ctrl+G), history, optional word wrap. F4 flips a preview into editing, F3 flips back, Ctrl+S or F2 saves. Loaded lazily, so it costs nothing until you use it.
  • External editor. Detected installs, or a custom command. A known editor opens at the right line and column — VS Code family, Notepad++, Sublime, Zed — and a folder opens as a project in editors that take one. A terminal editor (nvim, nano, micro, hx…) runs in the embedded terminal, in the panel’s folder, with +line where the editor understands it.
  • Byte-faithful, in-place saves. The file’s encoding, BOM, line endings and trailing newline are kept; the file is written in place. Before the write, the previous bytes are copied into the overwrite stash, so Ctrl+Z after a save restores the earlier version through the same undo as a move.
  • Refuses to clobber. A save checks that the file has not changed since it was read and that it is writable; a conflict, a vanished file or a read-only attribute each raise a banner with explicit actions rather than failing silently or overwriting.
  • From a search hit. F4 on a content-search result opens the file at its first matching line.

How to use it

  1. Put the cursor on a text file and press F4. By default the built-in editor opens for a local text file up to 8 MiB; larger or binary files go to the external editor, and the notice offers it.
  2. Edit, then Ctrl+S. The status line confirms Saved, with the encoding and EOL it kept.
  3. Change your mind? Ctrl+Z in the panel restores the previous bytes.
  4. Shift+F4 asks for a name, creates the file and drops you straight into the editor.
  5. Force the choice for one file: Ctrl+E is always the external editor, Ctrl+Shift+F4 always the built-in one (Far’s “force internal”).

Preferences ▸ Editor holds the two decisions: F4 opens (built-in or external) and External editor (default, each detected editor, or a custom command with arguments and an option to run it in the embedded terminal).

Where it works

TargetBuilt-in (default)External
Local text file ≤ 8 MiBQuick Look edit modeYour editor, at the line
Larger or binary fileExternal editor (offered)External editor
FolderExternal editor opens the foldersame
sftp:// / ftp:// textEdited in place through the providerTerminal editor in the SSH shell
Inside an archiveOpens read-onlysame

The built-in editor also watches the file: an external change while the buffer is clean reloads silently, like the file list does; with unsaved edits you get a Reload / Keep editing banner.

What it deliberately does not do

  • It does not run editors through a shell string. An external launch is argv-only, a .cmd shim is refused, and a bare command name is resolved on PATH — so a file name can never be interpreted as arguments.
  • It does not silently reformat, re-encode or normalise. If a file has mixed line endings, the status line says so and the save keeps the dominant style.
  • It does not save into archives, and it does not (yet) round-trip a remote file through a GUI editor via a temp copy; remote text goes to the built-in editor or a terminal editor instead.

Questions

Which external editors does cwdio recognise?

On Windows it looks for VS Code and VS Code Insiders, Cursor, Zed, Notepad++, Sublime Text and Notepad in their usual install locations, and honours $VISUAL then $EDITOR the way git does. Any other editor can be set as a custom command with {file}, {line}, {col} and {dir} placeholders. Terminal editors — vim, nvim, nano, micro, helix, emacs and friends — run inside cwdio's embedded terminal.

Will the built-in editor change my line endings or encoding?

No. A save re-encodes with the file's own encoding (UTF-8 with or without BOM, UTF-16 LE/BE), keeps its line-ending style and trailing-newline state, and writes in place so the file keeps its identity. The status line shows exactly what it read: Ln, Col, the encoding and CRLF or LF.

What happens if the file changed on disk while I was editing?

The save refuses and a banner offers Overwrite, Reload from disk, or Keep editing. If the file changed while your buffer was still clean it simply reloads; if you had unsaved edits you are told and asked. A read-only file gets a Make writable and save option. A decision is never a toast you might miss.

Can I edit a file on a server?

Yes. A text file on an SFTP or FTP panel opens in the built-in editor and is written back in place through the connection — no temporary copy to lose track of. If you prefer a terminal editor, it runs in the server's SSH shell against the remote path. Files inside an archive open read-only; extract to edit.