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.

This commit is contained in:
narutozxp 2025-10-21 21:10:29 +08:00 committed by GitHub
parent e8a1d8b628
commit 5f99101a09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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 = {