Neovim Remote Development

Inside Docker Container (eg. with devcontainers)

You need to first install Neovim inside the development container:

...
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    wget \
    curl \
    unzip \
    ripgrep \
    xclip \
    && rm -rf /var/lib/apt/lists/*
SHELL [ "/bin/bash", "-c" ]

# Install Rust toolchain and Neovim
RUN \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal --no-modify-path && \
    mkdir -p /opt/nvim && \
    wget -qO- "https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz" | tar -xz -C /opt/nvim --strip-components=1 && \
    ln -s /opt/nvim/bin/nvim /usr/local/bin/nvim
...

Remember to forward clipboard and port:

xhost +
docker run --rm -it \
	-p 6666:6666 \
	-v /tmp/.X11-unix:/tmp/.X11-unix \
	-e DISPLAY=$DISPLAY \
	...

Once built, inside the container, run:

nvim --headless --listen "0.0.0.0:6666"

Outside container run:

nvim --remote-ui --server "0.0.0.0:6666"