Docs
Edit over SSH
Edit files on another machine over SSH. strop uses the ssh already on your machine. Nothing is installed on the host.
strop ssh://devbox/etc/
strop +120 ssh://user@devbox/var/log/app.log
strop remote "ssh://user@devbox:2222/~/project/src/lib.rs"
strop remote URL is described in cli.md. -R opens read-only, as for a local file.
Connecting
Press Space o or run :remote to pick a host: the directories you opened before, the hosts you are connected to, and the hosts in your SSH config and known_hosts. Or select Add a host… and enter host, user@host:port or a complete ssh:// address. Opening the list does not log in; Enter connects. A new host starts at /. strop remembers, on this machine only, the directory you last opened on each host (in remote-destinations.json under $XDG_STATE_HOME/strop, normally ~/.local/state/strop).
:e ssh://devbox/
:filter app
:remote connect ssh://devbox
:remote list
:remote disconnect ssh://devbox
:remote clear
:e ssh://HOST/DIR/opens a folder;:filter TEXTnarrows it.:remote homelists your home directory on the current host;:remote rootgoes to/.:remote connectlogs in and keeps the connection;:remote disconnectcloses it (the current host when no address is given);:remote clearcloses every connection. The remembered directories stay.:remote listshows the open connections.
Once connected, you can edit. There is no second confirmation before you save files, search, use Git or open a terminal on the host.
Host aliases, keys, the agent and ProxyJump come from your ~/.ssh/config. strop cannot ask you for a password or a passphrase, and cannot ask you to accept a new host key. Log in once with plain ssh host to accept the key, and use a key or an agent. If login fails, strop shows ssh's own error and a hint.
strop logs in once per host and reuses that connection for every read, save, search and terminal, so you are not asked to log in again. The connection closes when strop exits. After a crash it closes by itself after ten idle minutes. (It is an OpenSSH ControlMaster; its socket is in a private directory under $XDG_RUNTIME_DIR.)
A folder on a host is the same buffer of names as one on your machine (see filesystem.md): size and age beside each name, blank for something the host did not report. Hidden files are shown, and .gitignore is not applied. Enter opens an entry; - goes up and puts the cursor back on the folder you came from. Tab completes host names and paths without logging in; paths on a host complete only once you are connected or have listed that directory before. In an ssh:// address write a space as %20, # as %23, ? as %3F and % as %25. A file is read whole and can be up to 256 MiB of UTF-8 text.
Saving
:w uploads the buffer to a temporary name beside the file, gives it the file's permissions and renames it over the original, so nobody ever reads a half-written file. A symlink is saved through to the file it points at.
- If the file on the host changed since it was read (its size or modification time is different),
:wis refused and your edits stay::e!reloads the host's version,:w!replaces it anyway. :w PATHor:w ssh://…writes a copy (a relative path is beside the file) and never replaces an existing file;:w! PATHdoes.- You can keep typing while a save is on its way. If you edit during the save, the buffer stays marked as modified.
What strop cannot protect against: if another program writes the file in the instant between strop's last check and its save, the later write wins, as in Vim. SFTP reports modification times in whole seconds, so a rewrite of the same size within the same second as your read goes unnoticed. When you replace a file that belongs to another user, the new file belongs to you.
File management
Edit a folder's names and :w on the host as on your machine: the list of changes first, then y to make them. See filesystem.md. On a host there is no Trash (a delete is for good), an existing file is never overwritten, a folder is not copied, and if a later change fails the earlier ones stay made.
Search, Git, language servers, terminal
They run on the host:
Space /searches the project on the host, using the host'srg. Replace across files does not work on a host yet.- Git: the change marks in the gutter, the log (
Space g l), blame and diffs use the host'sgit. Status, commit and the branch picker work only on your own machine for now (git.md). - A language server starts on the host when it is installed there. Its settings come from your local
languages.tomland from the project's.strop/languages.tomlon the host. :terminaland Space t in a remote file or directory open your login shell on the host. Ctrl-C and the window size work, and keys typed before the shell answers are kept.:terminal-localopens a shell on your own machine instead. To work inside a container, open a terminal and rundocker exec -it <container> sh.
rg, git and the language server must be installed on the host. Each command runs through your login shell there, so a slow shell startup file slows every search and Git query. csh-family login shells are not supported for commands with special characters.
This page is docs/remote.md from the strop repository at v0.80.0.