The problem
When you write Markdown locally, pasting images is trivial - plenty of Neovim plugins handle it. But when you're editing files on a remote server over SSH, your clipboard lives on a different machine than your editor. The remote Neovim has no access to your local clipboard, so none of those plugins work.
I ran into this while writing blog posts and documentation on remote machines. Taking a screenshot is easy, but getting that image from my local clipboard to the server and into the Markdown file required a manual workflow every time: save the screenshot locally, scp it over, then type the Markdown image link by hand.
How sshimg.nvim solves it
sshimg.nvim connects your local clipboard to your remote Neovim through a small daemon and an SSH reverse tunnel.
The flow looks like this:
Screenshot (local) → imgd daemon → SSH reverse tunnel → scp → Remote Neovim
- You take a screenshot on your local machine (it lands in the clipboard).
- You press
<leader>paor<leader>ppin Neovim. - The plugin contacts the local daemon through the SSH reverse tunnel.
- The daemon reads the image from the clipboard, sends it to the server via
scp. - Neovim inserts a Markdown image link at the cursor position.
The result:
Setup
Local machine
1. Install the daemon
The daemon imgd is a small Python script that reads images from wl-paste (Wayland) and serves them over a local port.
cp daemon/imgd.py ~/.local/bin/imgd
chmod +x ~/.local/bin/imgd2. Start the daemon
Start it as a systemd user service:
cp daemon/imgd.service ~/.config/systemd/user/imgd.service
systemctl --user enable --now imgdOr run it manually:
imgd3. Connect with a reverse tunnel
The reverse tunnel forwards port 9999 from the remote server back to your local machine, so the plugin can reach the daemon.
ssh -R 9999:localhost:9999 yourserverOr add it to ~/.ssh/config so you don't have to type it every time:
Host yourserver
RemoteForward 9999 localhost:9999
Remote server
Install the plugin with your package manager. For lazy.nvim:
return {
"AlexZeitler/sshimg.nvim",
config = function()
require("sshimg").setup({
port = 9999,
host = "127.0.0.1",
keymaps = {
assets = "<leader>pa", -- Save to ./assets/
parallel = "<leader>pp", -- Save to same dir as current file
},
})
end,
}The values shown are the defaults - you only need to change them if your tunnel uses a different port.
Usage
- Take a screenshot (it lands in your local clipboard).
- Open a Markdown file in remote Neovim.
- Press
<leader>pato save the image to./assets/or<leader>ppto save it next to the current file.
The plugin inserts the Markdown image link at your cursor position automatically.

Requirements
Local machine:
wl-paste(Wayland)scp- Python 3
Remote server:
- Neovim
- Python 3
Early days
sshimg.nvim currently supports Linux with Wayland. Support for X11 and macOS is planned. If you run into issues or have ideas, feel free to open an issue or send a pull request on GitHub.