Remote and containers¶
CodeArt has no remote-editing plugin. Neovim 0.12 can already run on one machine and show its screen on another, and that is what this page uses. In every setup below, CodeArt, its plugins, the language servers, Mason, formatters, run tasks and git all run on the remote machine; your local terminal only draws the screen and sends keys. When you disconnect, the remote Neovim stops.
Install CodeArt on the remote¶
Install CodeArt on the server the normal way (Installation), then copy your user/ folder so you get your own settings, plugins and key maps there too:
rsync -a ~/.config/nvim/user/ server:.config/nvim/user/
Start nvim on the server once (or run :CodeArtLanguages install) so the tools for your language packs install there. :CodeArtUpdate on the server updates the server's copy.
Plain SSH¶
The simplest way: log in and run Neovim in the SSH terminal.
ssh -t server nvim
This works everywhere, Windows included. If the connection drops, the session is gone (unsaved changes are kept in swap files). Run it inside tmux on the server if you want it to survive.
Attach over SSH¶
Neovim 0.12 can run without a screen (nvim --headless --listen), and a local Neovim can attach to it (nvim --remote-ui) or switch to it (:connect). Over SSH, start the server as the command of the SSH session with a tty (ssh -t, not nohup, so a dropped connection stops it) and forward its socket:
# 1. on the server, as the SSH session's command, with a tty: start CodeArt
# listening on a socket. Closing this session (or a dropped connection)
# stops the server. Do not use nohup.
ssh -t server 'mkdir -p -m 700 ~/.cache/nvim && CODEART_REMOTE=1 nvim --headless --listen ~/.cache/nvim/codeart.sock'
# 2. on your machine, after the server is up: forward the socket
# (the remote path must be absolute)
ssh -N -L /tmp/codeart-server.sock:/home/you/.cache/nvim/codeart.sock server
# 3. attach
nvim --remote-ui --server /tmp/codeart-server.sock
CODEART_REMOTE=1 makes the server quit when the last UI disconnects (:detach, closing the terminal, or a dropped client). Writable buffers are saved first; unsaved changes that cannot be written are discarded (a dropped SSH session may still leave swap files).
Inside the attached Neovim:
| Command | What it does |
|---|---|
:qa |
Quits the server and disconnects |
:detach |
Disconnects this screen; because it was the last UI, the server then stops |
:connect /tmp/codeart-server.sock |
From a Neovim you already have open, switch this screen to the server |
:connect! /tmp/codeart-server.sock |
The same, and stop the Neovim you came from if nothing else is attached to it |
A small helper for your shell config that starts the server, forwards the socket and attaches; when you quit, the server stops too:
nvim-ssh() {
local host=$1 sock="/tmp/nvim-$1.sock" remote_home remote_sock
remote_home=$(ssh "$host" 'echo $HOME') || return
remote_sock="$remote_home/.cache/nvim/codeart.sock"
ssh "$host" 'mkdir -p -m 700 ~/.cache/nvim' || return
rm -f "$sock"
ssh -tt "$host" "CODEART_REMOTE=1 nvim --headless --listen '$remote_sock'" &
local server_ssh=$!
for _ in $(seq 50); do ssh "$host" "test -S '$remote_sock'" && break; sleep 0.1; done
ssh -f -N -o ExitOnForwardFailure=yes -L "$sock:$remote_sock" "$host" || { kill $server_ssh; return; }
nvim --remote-ui --server "$sock"
wait $server_ssh 2>/dev/null
}
Things to know:
- Keep it a socket. A socket in a
700folder can only be used by your user on the server.--listenalso takes a TCP address, but a TCP port has no password: any user on the server could connect to it and run commands as you. nvimnot found?ssh server 'command'does not read your interactive shell config, so a Neovim installed by Homebrew or in~/.local/binmay be missing fromPATH. Use the full path, for example/opt/homebrew/bin/nvimor~/.local/bin/nvim.- Clipboard. Yanks go to the server's clipboard, not yours. To copy to your local clipboard, try
vim.g.clipboard = "osc52"inuser/(your terminal must support OSC 52). The remote check below does not cover the clipboard. - Messages. If the server has a message waiting when you attach, you see "Press ENTER"; press Enter.
The CI workflow runs this recipe on every change: scripts/ci/remote_check.sh starts a throwaway sshd on 127.0.0.1, a CodeArt server as the command of an SSH session, forwards the socket, attaches a terminal with :connect and with --remote-ui, and checks that closing the UI, :detach and ending the SSH session all stop the server. You can run it yourself with scripts/ci/remote_check.sh user@server.
Windows¶
- Windows as your machine: plain SSH works. The attach recipe works from WSL (it is Linux). From PowerShell,
nvim --remote-uiworks, but the Windows OpenSSH client may refuse to forward a Unix socket (ssh -L /tmp/...). Then your options are WSL, or a TCP port bound to 127.0.0.1 on a server nobody else uses:ssh -t server 'CODEART_REMOTE=1 nvim --headless --listen 127.0.0.1:6666',ssh -N -L 6666:127.0.0.1:6666 server, andnvim --remote-ui --server 127.0.0.1:6666locally. The server still stops when you disconnect or the SSH session ends. - Windows as the server: not covered; use WSL on that machine, or plain SSH into a Windows OpenSSH server.
Dev containers¶
A dev container is a remote machine that happens to run in Docker, so the same rule applies: install CodeArt inside it. The example has a devcontainer.json and a codeart.sh that installs Neovim 0.12, CodeArt's requirements and CodeArt, copies your user/ folder in (bind-mounted read-only) and installs the plugins. Copy both files to .devcontainer/ in your project and use the Dev Container CLI:
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . nvim
codeart.sh was tested in mcr.microsoft.com/devcontainers/base:ubuntu-24.04; it supports Debian and Ubuntu images on x86_64 and arm64. To attach with --remote-ui instead, start the server in one exec session (CODEART_REMOTE=1 nvim --headless --listen /tmp/codeart.sock) and attach with devcontainer exec --workspace-folder . nvim --remote-ui --server /tmp/codeart.sock; the server stops when you disconnect.