aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-14 11:51:01 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-14 11:51:01 +0100
commite20942db608da333482d7485f123342962e1127a (patch)
tree23c206001aea10166f4684d4337617b5c9f6feee /dot_config
parente564f01583cbc9e9182bfe3ceca734e8680d8d2f (diff)
downloaddotfiles-e20942db608da333482d7485f123342962e1127a.tar.gz
dotfiles-e20942db608da333482d7485f123342962e1127a.tar.bz2
dotfiles-e20942db608da333482d7485f123342962e1127a.zip
feat(nvim): wire OSC 52 clipboard provider on SSH sessions
Previously `clipboard` was set to empty inside SSH sessions on the assumption no clipboard tool would be reachable. That broke yank → host-clipboard on the remote-dev VM. nvim ≥0.10 ships a built-in OSC 52 provider (vim.ui.clipboard.osc52). The terminal emulator (ghostty locally, zellij forwarding inside it) handles the escape sequence and writes to the host's clipboard, so we get yank-to-host without needing wl-copy/xclip on the VM. Paste over OSC 52 is rarely supported by terminals (security), so we wire it but it's effectively a no-op; bracketed paste from the terminal still delivers clipboard contents into the buffer.
Diffstat (limited to 'dot_config')
-rw-r--r--dot_config/nvim/lua/config/options.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/dot_config/nvim/lua/config/options.lua b/dot_config/nvim/lua/config/options.lua
index 86529f6..1e8e30f 100644
--- a/dot_config/nvim/lua/config/options.lua
+++ b/dot_config/nvim/lua/config/options.lua
@@ -48,9 +48,23 @@ vim.opt.completeopt = { "menuone", "noselect", "popup", "fuzzy", "nearest" }
opt.scrolloff = 999 -- keep cursor vertically centered
opt.sidescrolloff = 5 -- horizontal scroll margin
--- Clipboard (deferred to avoid blocking startup on clipboard detection)
+-- Clipboard (deferred to avoid blocking startup on clipboard detection).
+-- On SSH sessions there is no wl-copy/xclip, so we wire nvim's built-in
+-- OSC 52 provider — the terminal emulator (ghostty/zellij) forwards the
+-- escape sequence to the host's clipboard. Paste over OSC 52 isn't widely
+-- supported by terminals (security), so we only override copy and leave
+-- paste as a no-op; bracketed paste still works for inserting clipboard
+-- contents into the buffer via the terminal.
vim.schedule(function()
- opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus"
+ if vim.env.SSH_TTY then
+ local osc52 = require("vim.ui.clipboard.osc52")
+ vim.g.clipboard = {
+ name = "OSC 52",
+ copy = { ["+"] = osc52.copy("+"), ["*"] = osc52.copy("*") },
+ paste = { ["+"] = osc52.paste("+"), ["*"] = osc52.paste("*") },
+ }
+ end
+ opt.clipboard = "unnamedplus"
end)
opt.mouse = "a" -- enable mouse in all modes