-- ~/.config/nvim/lua/config/clipboard.lua -- Only override clipboard when running over SSH. -- Locally, let Neovim auto-detect the system clipboard tool (xclip, pbcopy, wl-copy, etc.) if vim.env.SSH_TTY then local osc52 = require("vim.ui.clipboard.osc52") vim.g.clipboard = { name = "OSC 52 (SSH)", copy = { ["+"] = osc52.copy("+"), ["*"] = osc52.copy("*"), }, paste = { -- OSC52 paste reads back from the terminal via an escape sequence response. -- If your terminal supports it (Kitty, WezTerm, iTerm2, etc.), use it: ["+"] = osc52.paste("+"), ["*"] = osc52.paste("*"), }, } end -- Always sync unnamed register with the clipboard register vim.opt.clipboard = "unnamedplus"