Skip to content
New issue

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

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

Already on GitHub? # to your account

Disable path conversion for Git Bash #1983

Closed
5 of 10 tasks
Tantalus13A98B5F opened this issue Apr 14, 2020 · 2 comments
Closed
5 of 10 tasks

Disable path conversion for Git Bash #1983

Tantalus13A98B5F opened this issue Apr 14, 2020 · 2 comments
Labels

Comments

@Tantalus13A98B5F
Copy link

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash (Git Bash/MSYS under mintty)
    • zsh
    • fish

Problem / Steps to reproduce

It's the vim integration.

  1. Use the most recent Git for Windows (2.26.0)
  2. Type :FZF<CR> in Vim
  3. No new window of cmd.exe is started, and the window for vim itself would enter cmd.exe.

Seems the bash contained in Git for Windows is tranlating the /C arg for cmd.exe as a path (probably to C:\). The following patch would help (according to this)

diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index a84dcab..26dcaca 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -587,7 +587,7 @@ function! s:execute(dict, command, use_height, temps) abort
   elseif has('win32unix') && $TERM !=# 'cygwin'
     let shellscript = s:fzf_tempname()
     call writefile([command], shellscript)
-    let command = 'cmd.exe /C '.fzf#shellescape('set "TERM=" & start /WAIT sh -c '.shellscript)
+    let command = 'MSYS_NO_PATHCONV=1 cmd.exe /C '.fzf#shellescape('set "TERM=" & start /WAIT sh -c '.shellscript)
     let a:temps.shellscript = shellscript
   endif
   if a:use_height
@Konfekt
Copy link
Contributor

Konfekt commented May 14, 2024

While MSYS_NO_PATHCONV=1 is one solution, why prefer it over doubling the first slash as alternatively proposed ?

Konfekt added a commit to Konfekt/fzf that referenced this issue May 15, 2024
Despite its title 'Calling fzf#run with a list as source fail (n)vim is used from git bash' the issue in 

junegunn#3777

of running `:FZF` in Vim in Git Bash was apparently only fixed for Neovim in Git Bash on Windows 11, but not for Vim from Git Bash.

In view of this, replacing /C by ///C might be considered a universal fix.

This PR just proposes the patch in junegunn#1983 that still seems open.

In view of the fourth item in the most recent 2.45.0 https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues little seems to have changed regarding path conversion of arguments containing forward slashes
junegunn pushed a commit that referenced this issue May 15, 2024
* make :FZF work in Vim from Git Bash

Despite its title 'Calling fzf#run with a list as source fail (n)vim is used from git bash' the issue in 

#3777

of running `:FZF` in Vim in Git Bash was apparently only fixed for Neovim in Git Bash on Windows 11, but not for Vim from Git Bash.

In view of this, replacing /C by ///C might be considered a universal fix.

This PR just proposes the patch in #1983 that still seems open.

In view of the fourth item in the most recent 2.45.0 https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues little seems to have changed regarding path conversion of arguments containing forward slashes

* prefer doubling slashed instead of generic env. var

If MSYS_NO_PATHCONV=1 is used, then all arguments are preserved, in particular possibly paths passed in s:command.
Therefore, only avoid converting `/C` from `cmd` to a path.
@junegunn
Copy link
Owner

Fixed in #3798

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

No branches or pull requests

3 participants