Skip to content

Commit f112878

Browse files
cljolyagctute
andcommitted
feat: adjust fd --exec argument on windows automatically
This manually applies #60, with fixes on the condition. In Lua, 0 is not a false value, which means that: ```lua if vim.fn.has("win32") then print("Hi") end ``` actually prints "Hi" even on Linux (where `vim.fn.has("win32")` returns 0). I’m manually merging because the PR started from `master` and thus did not incorporate the changes from `dev`. Co-authored-by: agctute <cjyoung2001@yahoo.com>
1 parent f0e50ad commit f112878

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/telescope/_extensions/repo/list.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ M.prepare_command = function(opts)
1919
-- .git file in them.
2020
local find_repo_opts = { "--hidden", "--case-sensitive", "--absolute-path" }
2121
local find_user_opts = opts.fd_opts or {}
22-
local find_exec_opts = opts.fd_exec_opts or { "--exec", "echo", [[{//}]], ";" }
22+
local find_exec_opts = opts.fd_exec_opts or (function()
23+
if vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1 then
24+
return { "--exec", "powershell", [[echo {//}]], ";" }
25+
else
26+
return { "--exec", "echo", [[{//}]], ";" }
27+
end
28+
end)()
2329

2430
-- Expand '~'
2531
local search_dirs = {}

0 commit comments

Comments
 (0)