From 5f99101a0945519b7621eb86b2313f424039dbbf Mon Sep 17 00:00:00 2001 From: narutozxp <41829090+narutozxp@users.noreply.github.com> Date: Tue, 21 Oct 2025 21:10:29 +0800 Subject: [PATCH] fix(clipboad): When connecting to a remote server via VSCode's Remote - SSH extension, the `SSH_TTY` environment variable is not set. Consequently, both the `vscode-neovim` extension (when using the remote Neovim instance) and Neovim launched from VSCode's integrated terminal use the system clipboard, resulting in severe lag. --- lua/lazyvim/config/options.lua | 2 +- lua/lazyvim/plugins/extras/coding/yanky.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 2ae1b38d..809f5003 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -54,7 +54,7 @@ local opt = vim.opt opt.autowrite = true -- Enable auto write -- only set clipboard if not in ssh, to make sure the OSC 52 -- integration works automatically. -opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard +opt.clipboard = vim.env.SSH_CONNECTION and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions opt.confirm = true -- Confirm to save changes before exiting modified buffer diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 6285796d..5b43b7df 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -5,6 +5,9 @@ return { desc = "Better Yank/Paste", event = "LazyFile", opts = { + system_clipboard = { + sync_with_ring = not vim.env.SSH_CONNECTION, + }, highlight = { timer = 150 }, }, keys = {