powerline?

This commit is contained in:
Zacharias-Brohn
2025-12-16 22:11:47 +01:00
parent 21ec8c60d2
commit 172d0a67f6
+23 -22
View File
@@ -36,30 +36,31 @@ M.config = {
} }
-- Send raw escape sequence to the terminal, bypassing neovim's terminal handling. -- Send raw escape sequence to the terminal, bypassing neovim's terminal handling.
-- We use vim.loop (libuv) to open /dev/tty directly, which gives us a direct -- We use multiple fallback strategies to find a working method.
-- connection to the controlling terminal, bypassing neovim's I/O handling.
local tty_fd = nil
local function get_tty_fd()
if tty_fd then
return tty_fd
end
-- Open /dev/tty directly using libuv's fs_open
local fd, err = vim.loop.fs_open("/dev/tty", "w", 438) -- 438 = 0666 octal
if fd then
tty_fd = fd
else
vim.notify("zterm-navigator: failed to open /dev/tty: " .. (err or "unknown"), vim.log.levels.WARN)
end
return tty_fd
end
-- Send raw escape sequence to the terminal
local function send_to_tty(str) local function send_to_tty(str)
local fd = get_tty_fd() -- Strategy 1: Use nvim_chan_send to channel 2 (stderr)
if fd then -- This often bypasses neovim's terminal buffer processing
vim.loop.fs_write(fd, str) local ok = pcall(vim.api.nvim_chan_send, 2, str)
if ok then
return
end end
-- Strategy 2: Write to stderr directly
-- stderr is typically unbuffered and may bypass neovim
ok = pcall(function()
io.stderr:write(str)
io.stderr:flush()
end)
if ok then
return
end
-- Strategy 3: Use terminfo/termcap passthrough if available
-- This is a last resort
pcall(function()
io.write(str)
io.flush()
end)
end end
-- Send OSC 51 command to ZTerm for pane navigation -- Send OSC 51 command to ZTerm for pane navigation