Closed pynappo closed 1 year ago
Can you provide a precise example (with the command and the code from vim's side) of a situation where the current codebase causes an error because you use Powershell?
I personally do not use Windows, it's support was added due to a request from a user. After your answer, I'll tag the user and see if it works for them, and if it does, I'll pull it.
@vijaymarupudi I've written this as termopen_first_arg = { "cmd", "/d", "/e:off", "/f:off", "/v:off", "/c", self.command }
to turn off everything not needed, seems to be working fine.
Thanks @cpkio, @pynappo, could you try that out and make sure it works on your end?
Can you provide a precise example (with the command and the code from vim's side) of a situation where the current codebase causes an error because you use Powershell?
Apologies for the delay. The example that caused me to look into wrapping the command on Windows was the example code in the README that fzf's through a lua table:
coroutine.wrap(function()
local result = fzf.fzf({"choice 1", "choice 2"}, "--ansi")
-- result is a list of lines that fzf returns, if the user has chosen
if result then
print(result[1])
end
end)()
I bound it that to a keymap:
-- using lazy.nvim:
{
'vijaymarupudi/nvim-fzf',
config = function()
local fzf = require('fzf')
vim.keymap.set('n','<leader>\\', function()
-- insert above code...
end
end
}
Then executed the keymap on startup.
result on current master: result with this patch:
Thanks @cpkio, @pynappo, could you try that out and make sure it works on your end?
Yep, works for me! I'll add that to the patch real quick.
Just squash merged it, thanks for your contribution!
Background:
A few people (including me) use the settings in
:h shell-powershell
to change their default shell to be pwsh/powershell. This causes errors when opening the terminal with<
in the final fzf command as that operation is not supported currently.Description:
From very barebones testing this patch seems to work, but let me know whether this breaks something on your end.
For those using
cmd
by default it may also be worth looking into whether to check'shell'
before wrapping the command, but I thinkcmd
launches pretty fast on most systems.