Text Editor
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.
What opens in the editor
Section titled “What opens in the editor”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.
Editing
Section titled “Editing”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.
Saving
Section titled “Saving”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.
Changes on the server
Section titled “Changes on the server”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).
Unsaved edits and drafts
Section titled “Unsaved edits and drafts”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.
Encodings and line endings
Section titled “Encodings and line endings”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.
Size limits
Section titled “Size limits”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.