Use tmux and magic wormhole to get things from your remote computer to your tmux. If tmux has DISPLAY set, open the file locally!
- On your remote computer, display the magic wormhole code.
- Press ( prefix + w )
- Hit OK to transfer.
tmux-wormhole is written in Go. To install
tmux-wormhole successfully, you'll need Go version 1.13 or higher.
Setup with Tmux Plugin Manager
Set up this plugin via TPM by adding this to your
set -g @plugin 'gcla/tmux-wormhole'
Install the plugin by hitting prefix + I.
Clone the repo:
git clone https://github.com/gcla/tmux-wormhole ~/.tmux/plugins/tmux-wormhole
cd ~/.tmux/plugins/tmux-wormhole GO11MODULE=on go build -o tmux-wormhole cmd/tmux-wormhole/main.go
Source it by adding this to your
Reload TMUX's config with:
tmux source-file ~/.tmux.conf
Set these in your
- @wormhole-key - how to launch tmux-wormhole (default:
- @wormhole-save-folder - where to keep transferred files and directories (default: XDG download dir e.g.
- @wormhole-open-cmd - run this command after a file is transferred (default:
- @wormhole-no-default-open - just transfer, don't run anything afterwards (default:
- @wormhole-no-ask-to-open - after a file is transferred, ask the user interactively if the file should be opened (default:
- @wormhole-can-overwrite - allow tmux-wormhole to overwite a file or directory of the same name locally (default:
How does it work
The plugin uses sleight of hand to make it look as though its prompts are being displayed over the active pane. When you hit the tmux-wormhole hotkey, the plugin does the following:
- saves the contents of the active pane to a temporary file e.g.
- launches a new tmux session called
- a pane running
cat /tmp/wormhole ; sleep infinity
If you were to attach to the wormhole session, this pane should look like the currently active pane. Next the plugin will:
- create a new window called
wormhole-ABCin the active session
- with a single pane running the Go program
tmux-wormholeis a gowid application that overlays a dialog widget on top of a terminal widget. The terminal widget runs
tmux attach -L wormhole
Finally, the plugin swaps the currently active pane with the pane from
The effect is that the terminal now has a yellow dialog overlaid.
- tmux-thumbs for the project structure which I freely plagiarized!
- wormhole-william - a GoLang implementation of magic wormhole
- gowid - my Go TUI framework, which itself heavily depends on...
- tcell - like ncurses for GoLang