fzf.vim
fzf.vim copied to clipboard
No preview window on Windows
- [x] I have fzf 0.23.0 or above
- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (
man fzf
) - [x] I have searched through the existing issues
With :Ag
, there's a preview window but with :Rg
there isn't. I'd expect these commands to basically produce exactly the same visual output, but this is not the case.
Also I'm not quite sure how to enable the preview window, g:fzf_preview_window
and <C-/>
seem to have no effect in the Rg
window.
Environment: Ubuntu for Ag, Windows for Rg
Seems like this is an environment issue. I haven't noticed that in :messages
there's Preview window not supported (bash not found in PATH)
since it's immediately covered up by the --TERMINAL--
text.
Is there a reason bash is required for preview?
My guess is that's because currently only this shell script is supported for creating the preview: https://github.com/junegunn/fzf.vim/blob/master/bin/preview.sh
Also there are some assumptions made about what shell you are using on which OS (which should not be coupled to begin with), see here: https://github.com/junegunn/fzf.vim/issues/1139
This would require some more logic to check the actual shell instead of the OS and also offer preview scripts for bash
, CMD
and powershell/pwsh
at a minimum, I guess.
Does it work with pwsh now?
I also recently found another dimension to this. Recent Windows versions seem to add bash
to the Windows PATH
when WSL2 is installed, which starts a bash session in a WSL2 instance. For some reason, even though Vim's 'shell'
is set to "cmd", fzf seems to pick bash as the shell to run the preview command. This then leads to bash being told to execute something on a Windows path with the backslashes removed (I guess because they are seen as escapes), a drive letter in it and path section abbreviations (the Progra~1
stuff). So you can have fzf and fzf.vim properly installed on both Windows and the WSL2 instance and it will still not work.
Hi,
The error preview window not support (bash not found in PATH)
indicates that vim cannot find the path to the Bash shell on your system. It solves this Error. We must add bash
in the PATH.
- Win + x --->System --->advanced system settings ---> environment variables. in user variables, select path and clic edit.
- If you have installed
GIT
, the path isC:\Program Files\Git\bin
. add it in the step 1. - Try typing in cmd
bash
@Crzek We recently updated the code to automatically pick up C:\Program Files\Git\bin\bash.exe
( bdf48c282ad2174c25c059b3cdb7956427b07a99). Please update and test if it works as expected.
@junegunn, you may also need to check if it is in C:\Users\USERNAME\scoop\apps\git\current\bin\bash.exe
.
scoop install git
will install Git for Windows to C:\Users\USERNAME\scoop\apps\git\current
.
The USERPROFILE
environment variable should give the C:\Users\USERNAME
part.
@ykhan21 Thanks. Can you open a pull request?
If someone else can add it, that would be great. I'm having the same issues with fzf.vim as https://github.com/junegunn/fzf.vim/issues/703, so I can't test any changes I make.
In the Git Bash shell that comes with Git for Windows, most of the fzf commands do not work. Running them opens an empty cmd shell.