junegunn / fzf.vim

fzf :heart: vim
MIT License
9.59k stars 582 forks source link

Files command not working with cmd, may be shell escape issue (but FZF is working) #1371

Closed icthus56 closed 2 years ago

icthus56 commented 2 years ago

In gvim when launching fzf via files, the following external command is executed: C:\WINDOWS\system32\cmd.exe /c (^(C:\Users\leessy\vimfiles\bundle\fzf/bin/fzf --version --no-height^) >C:\Users\leessy\AppData\Local\Temp\VIo13CB.tmp 2>^&1

There seems to be an issue with the "2>^&1" as passing "2>&1" directly to the gvim command line results in a successful execution. The full path to fzf binary is given, so that is not the issue.

See below for the error that results from the "Files" command:

image

gmonein commented 2 years ago

I had the same issue, after checking https://github.com/junegunn/fzf.vim/issues/1368

I figured that my issue was there because I had a custom shell: $HOME/.config/nvim/init.vim

set shell=mycustonshell

~/.local/bin/mycustomshell

#!/bin/zsh
# ... Some strange hackery code
zsh

I fixed my issue by setting shell to zsh $HOME/.config/nvim/init.vim

set shell=zsh
icthus56 commented 2 years ago

I wonder if there is an issue with the shell detection and escaping. Unfortunately I cannot set my shell to zsh as I am in Windows. I'm perplexed that it seems like I'm the only one with the issue though....

icthus56 commented 2 years ago

@junegunn do you have any idea where this escaping issue comes from or what I can modify to get FZF working under Win10? Thanks.

jrudel commented 2 years ago

@icthus56 I am on Win10 and the same thing was happening to me. I had set my shell to powershell instead of the default of C:\Windows\system32\cmd.exe. Once I reverted back to the default shell, I was able to get :Files to work. You can see the current value of your shell by typing :echo &shell in vim. Hope this helps.

icthus56 commented 2 years ago

@jrudel Thanks, your comment helped to find my issue. It turned out that shellxescape was set somwhere deep. Thanks for your help.