Skip to content

Commit 997eb7f

Browse files
binarypieclaude
andcommitted
nvim(devcube): disable OSC 52 paste to stop clipboard timeouts
OSC 52 copy is fire-and-forget, but paste sends a clipboard-read query and blocks on a terminal reply. Ghostty doesn't answer OSC 52 reads, and the container > zellij > nvim chain won't relay one anyway, so paste hung until timeout. Keep copy on OSC 52; route paste-in through terminal-level paste (ctrl+shift+v) instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 306ef4c commit 997eb7f

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

dot_files/nvim/config/lua/hypercube/config.lua

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,34 @@ function M.setup()
1111
},
1212
})
1313

14-
-- Portable clipboard via OSC 52.
14+
-- Portable clipboard via OSC 52 (copy only).
1515
-- Inside the Hypercube container we can't reach the host Wayland/pbcopy
16-
-- socket, so route yanks/pastes through the terminal escape sequence. This
16+
-- socket, so route yanks out through the terminal escape sequence. This
1717
-- works locally on Ghostty and over SSH, keeping the sandbox portable.
1818
-- Gated on DEVCUBE so a host-native nvim keeps its own clipboard.
19+
--
20+
-- Paste is intentionally NOT wired to OSC 52. Reading the clipboard requires
21+
-- querying the terminal and waiting for a reply, but Ghostty (and most
22+
-- terminals) don't answer OSC 52 read requests, so nvim blocks until it
23+
-- times out. Instead, paste into nvim with terminal/OS-level paste
24+
-- (ctrl+shift+v), which arrives as a bracketed paste and never touches the
25+
-- +/* registers. The no-op paste handlers below keep those registers from
26+
-- triggering the blocking terminal query.
1927
if vim.env.DEVCUBE == "1" then
2028
local ok, osc52 = pcall(require, "vim.ui.clipboard.osc52")
2129
if ok then
30+
local noop_paste = function()
31+
return { vim.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
32+
end
2233
vim.g.clipboard = {
23-
name = "OSC 52",
34+
name = "OSC 52 (copy only)",
2435
copy = {
2536
["+"] = osc52.copy("+"),
2637
["*"] = osc52.copy("*"),
2738
},
2839
paste = {
29-
["+"] = osc52.paste("+"),
30-
["*"] = osc52.paste("*"),
40+
["+"] = noop_paste,
41+
["*"] = noop_paste,
3142
},
3243
}
3344
end

0 commit comments

Comments
 (0)