Introducing sshimg.nvim: Paste Images into Remote Neovim over SSH

Published on Monday, March 16, 2026

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
  1. You take a screenshot on your local machine (it lands in the clipboard).
  2. You press <leader>pa or <leader>pp in Neovim.
  3. The plugin contacts the local daemon through the SSH reverse tunnel.
  4. The daemon reads the image from the clipboard, sends it to the server via scp.
  5. Neovim inserts a Markdown image link at the cursor position.

The result:

![](assets/2026-03-15-23-25-25.png)

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/imgd

2. Start the daemon

Start it as a systemd user service:

cp daemon/imgd.service ~/.config/systemd/user/imgd.service
systemctl --user enable --now imgd

Or run it manually:

imgd

3. 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 yourserver

Or 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

  1. Take a screenshot (it lands in your local clipboard).
  2. Open a Markdown file in remote Neovim.
  3. Press <leader>pa to save the image to ./assets/ or <leader>pp to save it next to the current file.

The plugin inserts the Markdown image link at your cursor position automatically.

Neovim with a pasted Markdown image link over SSH

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.

What are your thoughts about
"Introducing sshimg.nvim: Paste Images into Remote Neovim over SSH"?
Drop me a line - I'm looking forward to your feedback!