From 3c7ab130482d57dc8a4e8dd43caafd32e66fd495 Mon Sep 17 00:00:00 2001 From: minco Date: Fri, 12 Dec 2025 13:36:05 +0900 Subject: [PATCH] feat: initial commit --- README.md | 7 +++++++ access.sh | 5 +++++ config.sh | 8 ++++++++ local.sh | 7 +++++++ remote.sh | 7 +++++++ 5 files changed, 34 insertions(+) create mode 100644 README.md create mode 100755 access.sh create mode 100755 config.sh create mode 100755 local.sh create mode 100755 remote.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..2d9ea50 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Nvim Remote PoC + +## Usage +1. Modify `config.sh` +2. Run `remote.sh` in the remote PC +3. Run `local.sh` in the local PC +4. Run `access.sh` in the local PC to launch neovim diff --git a/access.sh b/access.sh new file mode 100755 index 0000000..ce5f85b --- /dev/null +++ b/access.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +. ./config.sh + +exec nvim --server $LOCAL_SOCK --remote-ui diff --git a/config.sh b/config.sh new file mode 100755 index 0000000..548ff15 --- /dev/null +++ b/config.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +LOCAL_PORT=12344 +LOCAL_SOCK=/tmp/local_server1.sock + +REMOTE_SSH=allen@localhost +REMOTE_PORT=12345 +REMOTE_SOCK=/tmp/server1.sock diff --git a/local.sh b/local.sh new file mode 100755 index 0000000..0d04d99 --- /dev/null +++ b/local.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +. ./config.sh + +ssh -L $LOCAL_PORT:localhost:$REMOTE_PORT $REMOTE_SSH -N & + +socat UNIX-LISTEN:$LOCAL_SOCK,fork,reuseaddr,unlink-early TCP-CONNECT:localhost:$LOCAL_PORT diff --git a/remote.sh b/remote.sh new file mode 100755 index 0000000..7ad8509 --- /dev/null +++ b/remote.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +. ./config.sh + +nvim --headless --listen $REMOTE_SOCK & + +socat TCP-LISTEN:$REMOTE_PORT,fork,reuseaddr UNIX-CONNECT:$REMOTE_SOCK