Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong path scheme on windows #1411

Closed
grappas opened this issue Jul 29, 2022 · 10 comments
Closed

Wrong path scheme on windows #1411

grappas opened this issue Jul 29, 2022 · 10 comments

Comments

@grappas
Copy link

grappas commented Jul 29, 2022

I have recently got back on Windows, fired PlugInstall and all of the sudden I cannot run fzf anymore. Seems like plugin uses slashes in path instead of backslashes.
Running neovim 0.7.2 on Windows 11.
obraz

@junegunn
Copy link
Owner

junegunn commented Jul 29, 2022

Are you running the latest version of the main repo?

Is this patch included in your copy?
junegunn/fzf@728f735

@grappas
Copy link
Author

grappas commented Jul 30, 2022

Are you running the latest version of the main repo?

Installed with vim-plug, so yes I think so.
obraz
obraz

Is this patch included in your copy?

It not seems to be there
obraz

@junegunn
Copy link
Owner

junegunn commented Jul 30, 2022

It not seems to be there

Strange. Why git pull is not fetching the latest commits?

https://github.com/junegunn/fzf/commits/master

What does git show-ref HEAD show in plugged/fzf directory?

@grappas
Copy link
Author

grappas commented Jul 30, 2022

What does git show-ref HEAD show in plugged/fzf directory?

obraz

@junegunn
Copy link
Owner

Then you have the latest version. A few questions:

  • Inside Vim, what is your
  • :echo &shell?
  • :echo fzf#exec()
  • :echo system(fzf#exec() . ' --version')
  • :echo system(shellescape(fzf#exec()) . ' --version')
  • :echo system('&' . shellescape(fzf#exec()) . ' --version')

@grappas
Copy link
Author

grappas commented Jul 30, 2022

:echo &shell?

obraz

:echo fzf#exec()

obraz

:echo system(fzf#exec() . ' --version')

obraz

:echo system(shellescape(fzf#exec()) . ' --version')

obraz

:echo system('&' . shellescape(fzf#exec()) . ' --version')

obraz

@grappas
Copy link
Author

grappas commented Jul 30, 2022

if has('win64') set shell=powershell.exe set shellxquote= let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ' let &shellquote = '' let &shellpipe = '| Out-File -Encoding UTF8 %s' let &shellredir = '| Out-File -Encoding UTF8 %s' endif

in init.vim

@junegunn
Copy link
Owner

Can you try applying this patch to the main fzf repo and see if it helps?

diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 6fada6c..4dd7ece 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -164,7 +164,7 @@ function s:get_version(bin)
   if has_key(s:versions, a:bin)
     return s:versions[a:bin]
   end
-  let command = (&shell == 'powershell' ? '&' : '') . shellescape(a:bin) . ' --version --no-height'
+  let command = (&shell =~ 'powershell' ? '&' : '') . shellescape(a:bin) . ' --version --no-height'
   let output = systemlist(command)
   if v:shell_error || empty(output)
     return ''

@grappas
Copy link
Author

grappas commented Jul 30, 2022

Yep - it done the trick.

Have a 🍺 :)

@junegunn
Copy link
Owner

Thanks for the confirmation, I've pushed to fix to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants