Skip to content

Commit dba2c13

Browse files
committed
feat: honor $FZF_LUA_NVIM_RUNTIME in headless spawn
1 parent e791360 commit dba2c13

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lua/fzf-lua/shell.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,14 @@ end
528528
M.wrap_spawn_stdio = function(opts)
529529
local is_win = utils.__IS_WINDOWS
530530
local nvim_bin = os.getenv("FZF_LUA_NVIM_BIN") or vim.v.progpath
531+
local nvim_runtime = (function()
532+
local rt = os.getenv("FZF_LUA_NVIM_RUNTIME")
533+
if not rt then return "" end
534+
return string.format(
535+
is_win and [[set VIMRUNTIME=%s& ]] or "VIMRUNTIME=%s ",
536+
is_win and vim.fs.normalize(rt) or libuv.shellescape(rt)
537+
)
538+
end)()
531539
-- TODO: should we check "cmd"?
532540
for _, k in ipairs({ "contents", "fn_transform", "fn_preprocess", "fn_postprocess" }) do
533541
local v = opts[k]
@@ -536,7 +544,8 @@ M.wrap_spawn_stdio = function(opts)
536544
M.check_upvalue(v, "opts." .. k)
537545
end
538546
end
539-
local cmd_str = ("%s -u NONE -l %s %s"):format(
547+
local cmd_str = ("%s%s -u NONE -l %s %s"):format(
548+
nvim_runtime,
540549
libuv.shellescape(is_win and vim.fs.normalize(nvim_bin) or nvim_bin),
541550
libuv.shellescape(vim.fn.fnamemodify(is_win and vim.fs.normalize(__FILE__) or __FILE__, ":h") ..
542551
"/spawn.lua"),

0 commit comments

Comments
 (0)