powerline?

This commit is contained in:
Zacharias-Brohn
2025-12-16 22:10:06 +01:00
parent 4aecd7a855
commit 21ec8c60d2
+18 -16
View File
@@ -35,28 +35,30 @@ M.config = {
}, },
} }
-- Create a persistent TTY handle for writing escape sequences directly to the terminal. -- Send raw escape sequence to the terminal, bypassing neovim's terminal handling.
-- This bypasses neovim's terminal handling by using libuv to write to stdout. -- We use vim.loop (libuv) to open /dev/tty directly, which gives us a direct
local tty_handle = nil -- connection to the controlling terminal, bypassing neovim's I/O handling.
local tty_fd = nil
local function get_tty_handle() local function get_tty_fd()
if tty_handle then if tty_fd then
return tty_handle return tty_fd
end end
-- Create a TTY handle wrapping stdout (fd 1) -- Open /dev/tty directly using libuv's fs_open
-- The second parameter (true) means readable=false (write-only) local fd, err = vim.loop.fs_open("/dev/tty", "w", 438) -- 438 = 0666 octal
local handle = vim.loop.new_tty(1, false) if fd then
if handle then tty_fd = fd
tty_handle = handle else
vim.notify("zterm-navigator: failed to open /dev/tty: " .. (err or "unknown"), vim.log.levels.WARN)
end end
return tty_handle return tty_fd
end end
-- Send raw escape sequence to the terminal, bypassing neovim's terminal handling -- Send raw escape sequence to the terminal
local function send_to_tty(str) local function send_to_tty(str)
local handle = get_tty_handle() local fd = get_tty_fd()
if handle then if fd then
handle:write(str) vim.loop.fs_write(fd, str)
end end
end end