Skip to content

Commit 2671c6a

Browse files
committed
fix(zmx): fix socket env when old kitty instance died
1 parent f8b0c61 commit 2671c6a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lua/fzf-lua-extra/providers/zmx.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ local __DEFAULT__ = {
2828
local r = parse(sel)
2929
if not r then return end
3030
-- local kwin = assert(os.getenv('KITTY_WINDOW_ID'), 'only support kitty')
31+
local ksock = assert(os.getenv('KITTY_LISTEN_ON'), 'only support kitty')
32+
ksock = (ksock:gsub('unix:', ''))
33+
if not vim.uv.fs_stat(ksock) then -- fix kitty socket
34+
ksock = vim.split(vim.fn.glob(vim.fs.joinpath(vim.fs.dirname(ksock), '/kitty-*')), '\n')[1]
35+
if not ksock or not vim.uv.fs_stat(ksock) then error('kitty socket not found') end
36+
vim.env.KITTY_LISTEN_ON = 'unix:' .. ksock
37+
end
3138
local kwin = vim.fn.system(
3239
[[kitten @ ls | jq -r '.[] | select(.is_focused == true) | .tabs[] | select(.is_focused == true) | .windows[] | select(.is_focused == true) | .id']]
3340
)

0 commit comments

Comments
 (0)