From c09f71fe3d869741bf971e0d7d3dd01aeacab59e Mon Sep 17 00:00:00 2001 From: Enno Date: Wed, 15 May 2024 07:22:41 +0200 Subject: [PATCH 1/2] 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 https://github.com/junegunn/fzf/issues/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 https://github.com/junegunn/fzf/issues/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 --- plugin/fzf.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 735571cff37..af4965fa293 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -711,7 +711,7 @@ function! s:execute(dict, command, use_height, temps) abort elseif has('win32unix') && $TERM !=# 'cygwin' let shellscript = s:fzf_tempname() call s: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 From 9dcab6af214747c76e4d7326f0b5bb2798955167 Mon Sep 17 00:00:00 2001 From: Enno Date: Wed, 15 May 2024 09:42:53 +0200 Subject: [PATCH 2/2] 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. --- plugin/fzf.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index af4965fa293..fc7b196aad7 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -711,7 +711,7 @@ function! s:execute(dict, command, use_height, temps) abort elseif has('win32unix') && $TERM !=# 'cygwin' let shellscript = s:fzf_tempname() call s:writefile([command], shellscript) - let command = 'MSYS_NO_PATHCONV=1 cmd.exe /C '.fzf#shellescape('set "TERM=" & start /WAIT sh -c '.shellscript) + let command = 'cmd.exe //C '.fzf#shellescape('set "TERM=" & start /WAIT sh -c '.shellscript) let a:temps.shellscript = shellscript endif if a:use_height