Skip to content

Commit b070bf5

Browse files
phanenibhagwan
authored andcommitted
fix(cli): make skim work
1 parent b1acef5 commit b070bf5

6 files changed

Lines changed: 14 additions & 5 deletions

File tree

lua/fzf-lua/config.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,13 @@ function M.normalize_opts(opts, globals, __resume_key) ---@diagnostic disable
744744
local bin, version, changelog = (function()
745745
if opts.__SK_VERSION then
746746
return "sk", opts.__SK_VERSION, {
747-
-- All fzf flags values not support by skim
747+
-- All fzf flags values not support by skim (https://github.com/skim-rs/skim/issues/628)
748748
["99.9.9"] = {
749749
fzf_opts = {
750-
["--border"] = { "none" },
751-
["--info"] = { "inline-right" },
750+
["--border"] = { "none" },
751+
["--info"] = { "inline-right" },
752+
["--border-label-pos"] = true,
753+
["--info-command"] = true,
752754
}
753755
},
754756
["1.5.3"] = {

lua/fzf-lua/core.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ M.preview_window = function(o, fzf_win)
496496
return border and string.format(":%s", border) or ""
497497
end)()
498498
)
499+
-- https://github.com/skim-rs/skim/issues/964
500+
if preview.pty and utils.has(o, "sk") then prefix = "pty:" .. prefix end
499501
if utils.has(o, "fzf", { 0, 31 })
500502
-- fzf v0.45 added transform, v0.46 added resize event
501503
-- which we use for changing the layout on resize

lua/fzf-lua/defaults.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ end
115115
---Debounce time (milliseconds) for displaying the preview buffer in the builtin previewer.
116116
---@field delay? integer
117117
---@field winopts fzf-lua.config.PreviewerWinopts Window options for the builtin previewer.
118+
---(skim only option), allow preview process run in pty
119+
---@field pty? boolean
118120

119121
---missing fields are injected later, not sure how to tell luals about it
120122
---@class fzf-lua.config.Defaults: fzf-lua.config.Base,{}

lua/fzf-lua/previewer/fzf.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ local function make_screenshot(screenshot, addr, lines, columns)
532532
end
533533
return utils.rpcexec(addr, "nvim_exec_lua", [[
534534
local lines, columns, screenshot = ...
535-
return vim._with({ go = { lines = lines, columns = columns } }, function()
535+
return vim._with({ o = { lines = lines, columns = columns } }, function()
536536
vim.api.nvim__screenshot(screenshot)
537537
end)
538538
]], { lines, columns, screenshot })

lua/fzf-lua/providers/nvim.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,9 @@ M.serverlist = function(opts)
807807
end)
808808
cb(nil)
809809
end
810+
if utils.has(opts, "sk", "3.0.0") then
811+
opts = vim.tbl_deep_extend("force", opts, { winopts = { preview = { pty = true } } })
812+
end
810813
core.fzf_exec(function(cb)
811814
vim.defer_fn(function() f(cb) end, 50) -- wait for spawn/remote_exec?
812815
end, opts)

scripts/cli.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ _G.fzf_jobstart = function(cmd, opts)
5252
FzfLua.libuv.uv_spawn(cmd[1], {
5353
cwd = opts.cwd,
5454
args = vim.list_slice(cmd, 2),
55-
stdio = { 0 },
55+
stdio = { 0, 1, 2 }, -- sk require stderr
5656
env = opts.env,
5757
},
5858
vim.schedule_wrap(function(rc)

0 commit comments

Comments
 (0)