From cc4bd1c90702930c306272e7c2ebd6fb39886dbc Mon Sep 17 00:00:00 2001 From: juancwu Date: Wed, 4 Feb 2026 00:12:22 +0000 Subject: [PATCH] (nvim) file clipboard --- nvim/lua/juancwu/config/clipboard.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nvim/lua/juancwu/config/clipboard.lua b/nvim/lua/juancwu/config/clipboard.lua index 8285a1e..4e11b15 100644 --- a/nvim/lua/juancwu/config/clipboard.lua +++ b/nvim/lua/juancwu/config/clipboard.lua @@ -2,6 +2,7 @@ local Utils = require("juancwu.utils") if Utils.os.is_linux() then local wayland_display = os.getenv("WAYLAND_DISPLAY") + local ssh_tty = os.getenv("SSH_TTY") if Utils.os.is_wsl() then vim.g.clipboard = { name = "win32yank", @@ -15,6 +16,20 @@ if Utils.os.is_linux() then }, cache_enabled = 0, } + elseif ssh_tty then + local clip_path = vim.fn.expand("~/.clipboard") + vim.g.clipboard = { + name = "file-clipboard", + copy = { + ["+"] = { "tee", clip_path }, + ["*"] = { "tee", clip_path }, + }, + paste = { + ["+"] = { "cat", clip_path }, + ["*"] = { "cat", clip_path }, + }, + cache_enabled = 1, + } elseif wayland_display then vim.g.clipboard = { name = "wl-clipboard",