Skip to content

Text Editor

This content is for the 1.0.0 version. Switch to the latest version for up-to-date documentation.

The text editor opens one remote file over SFTP and saves it back to the server. Open it from the file browser with Edit in a file’s menu, or with the edit button in a text file’s preview. It is the same editor that workspaces use for each tab, so highlighting, search and conflict handling behave the same in both.

Edit is offered for text files and for files with no extension or an unknown one. Files with a known binary extension (images, archives, media, executables, office documents) go to the preview instead. If a file turns out to contain binary data, the editor shows Binary file and does not load it as text.

Syntax highlighting is chosen from the file name:

Group Languages
Programming C, C++, C/C++ headers, Dart, Go, Java, JavaScript, Kotlin, Python, Ruby, Rust, Swift, TypeScript
Shell Shell, Bash, Zsh
Web and markup HTML, CSS, XML, Markdown
Data and config JSON, YAML, TOML, INI, SQL, .conf and .cfg files, .env files
Build Dockerfile, Makefile

Dockerfile, Makefile and .env files are recognized by name. Everything else, including .log and .txt files, opens as plain text. Supported File Types lists the extensions.

The editor shows line numbers and the cursor position (Ln, Col) and supports code folding, Undo and Redo.

  • Find and replace. Find opens a search bar with Match case, Whole word and Regular expression options, a match counter and Next match / Previous match. Toggle replace adds Replace and Replace all.
  • Editor settings. Font size, Word wrap and Indent: Auto (detected from the file), 2 spaces, 4 spaces or Tabs.
  • Hardware keyboard. Shortcuts cover save, find, replace, go to line and toggling line comments. See Keyboard Shortcuts.

Save writes the file back over SFTP. A save never leaves a half-written file on the server:

  • The new content is uploaded to a temporary file next to the original and then renamed over it. The file keeps its permissions.
  • If the server does not allow the rename (for example, the file belongs to another user in a directory you cannot write to), PocketCmd writes into the existing file instead. Owner, group, ACLs and hard links are kept; the write is not atomic.
  • Saving a symbolic link writes to the file the link points to.
  • If a save fails, the editor keeps your text, stores a local draft and says so. When the content already reached the temporary file on the server, the message names that file.

There is no auto-save in the single-file editor.

PocketCmd checks the file’s size and modification time against the version you opened:

  • If the file changes or is deleted on the server while it is open, a banner says so.
  • If you save after the file changed on the server, the save stops with “Not saved: the file changed on the server”. Choose Reload to take the server’s version, Keep mine to overwrite it or Compare to see the two versions as a line diff (side by side on wide screens, inline on narrow ones).

When the app goes to the background or quits with unsaved changes, or a save fails, the editor stores an encrypted draft of the file. Drafts stay on this device only and are never synced. The next time you open the same file, it offers the draft back as “Unsaved edits recovered”, with Restore and Discard. A draft never replaces the file on the server by itself; you still have to save.

Drafts are deleted after a successful save, removed 30 days after they were stored, and removed when you delete the last server for that host. Settings › Data › Unsaved drafts lists every stored draft by host, path, size and age, and lets you delete them. It never shows their content.

The editor detects the encoding when it loads a file: a byte-order mark selects UTF-8, UTF-16 LE or UTF-16 BE; otherwise valid UTF-8 is read as UTF-8 and anything else as Latin-1. A file you open and save without changes is written back byte for byte, including its line endings.

A file with mixed line endings shows a banner and is saved with its most common line ending once you edit it.

Editing loads the whole file into memory. Files over 2 MB show Too large to edit, with Load anyway to open them regardless. 16 MB is the hard limit. For large logs, use less or tail in a terminal, or download the file.