[vim/vim] Msys vim's executable() can't find programs despite them being add in the PATH (Issue #14823)

14 views
Skip to first unread message

ykhan21

unread,
May 21, 2024, 3:37:48 PMMay 21
to vim/vim, Subscribed

Steps to reproduce

  1. On Windows, install msys (https://www.msys2.org/).
  2. Install the scoop package manager (https://scoop.sh/) on Windows (not in an msys environment).
  3. Install fzf with scoop (scoop install fzf) on Windows (not in an msys environment).
  4. Open an msys ucrt terminal by typing ucrt in the Windows search bar. This will start bash.
  5. Use pacman to upgrade vim.
  6. Open another terminal with regular Windows cmd.exe.
  7. Observer that fzf is found in cmd but not bash.
  8. Add ~/scoop/shims to the PATH variable in ~/.bashrc (in the ucrt terminal). Source the ~/.bashrc file in bash.
  9. Observe that you can now find fzf in bash. which fzf should return /c/Users/KhanY_z23jg7i/scoop/shims/fzf.
  10. Start vim in bash.
  11. Run :echo executable('fzf'). Observer that vim can't find fzf despite it being added to the path.
  12. Add `set rtp+=~/scoop/shims' to the .vimrc and source it.
  13. Observe that :echo executable('fzf') still can't find fzf.

Expected behaviour

Vim in msys should be able to find executables present in the PATH environment variable or in the vim runtimepath.

This is strange because Git Bash's vim can find fzf from the PATH variable (without it being added to the runtimepath).

Git Bash's (https://git-scm.com/download/win) vim version: 9.1.264
Msys's vim version: 9.1.380

Version of Vim

9.1.380

Environment

OS: Windows
Environment: msys
TERM: xterm
Shell: bash

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823@github.com>

Enno

unread,
May 21, 2024, 3:50:52 PMMay 21
to vim/vim, Subscribed

Fzf can be found in Vim in Git Bash so that I wonder what the difference to MSYS2 vim is.
Confusingly, at the end Git Bash's vim is mentioned, but MSYS(2) has to be installed.
Would it not help to have the outputs of %PATH% respectively $PATH, in particular in Vim?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123332995@github.com>

Enno

unread,
May 21, 2024, 3:52:30 PMMay 21
to vim/vim, Subscribed

Vim in msys should be able to find executables present in the PATH environment variable

Or does this imply that $PATH in Vim in MSYS(2) was checked to be the same as in Vim in Git Bash?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123335338@github.com>

Enno

unread,
May 21, 2024, 3:54:49 PMMay 21
to vim/vim, Subscribed

There's a some conversion to include%PATH% into $PATH, so maybe that's where the difference lies. Git Bash Vim is a more common setup than MSYS Vim, so perhaps some path in %PATH% is amiss?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123338664@github.com>

ykhan21

unread,
May 21, 2024, 5:04:12 PMMay 21
to vim/vim, Subscribed

Confusingly, at the end Git Bash's vim is mentioned, but MSYS(2) has to be installed.

Git Bash (GB) doesn't need to be installed. I was just noting that Git Bash's vim is able to pick up fzf because GB's vim, which seems to be a discrepancy as MSYS's vim and GB's vim are both compiled under MSYS.

Or does this imply that $PATH in Vim in MSYS(2) was checked to be the same as in Vim in Git Bash?

There's a some conversion to include%PATH% into $PATH, so maybe that's where the difference lies. Git Bash Vim is a more common setup than MSYS Vim, so perhaps some path in %PATH% is amiss?

GB's $PATH will inherit from Window's %PATH%. MSYS's $PATH will not.

When I installed scoop on Windows, scoop added the scoop\shims directory to the Windows %PATH%, causing it to automatically appear in the Git Bash $PATH.

However, I have added the ~/scoop/shims scoop directory to the $PATH in the ~/.bashrc file by adding the line export PATH=$PATH:"~/scoop/shims".

This worked to make MSYS's bash aware of fzf, but not MSYS's vim.

Would it not help to have the outputs of %PATH% respectively $PATH, in particular in Vim?

:echo %PATH% in vim returns:

E15: Invalid expression: "%PATH%"

:echo $PATH in MSYS's vim:

/ucrt64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/
Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:
~/scoop/shims:~/scoop/shims:~/scoop/shims

:echo $PATH in GB's vim:

/c/Users/username/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/username/bin:/c/Program Files (x86)/VMware/VMware Player/bin:/c/Program Files (x86)/Intel/Intel(R) M
anagement Engine Components/iCLS:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Wind
ows/System32/OpenSSH:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management
Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WIN
DOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files/dotnet:/c/ProgramData/chocolatey/bin:/c/Program Files (x86)/gnupg/bin:/c
/Program Files/Amazon/AWSCLIV2:/c/Program Files/Amazon/AWSSAMCLI/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Progra
m Files/Go/bin:/c/Program Files/nodejs:/c/Program Files/Docker/Docker/resources/bin:/c/Program Files/Cloudflare/Cloudflare WARP:/c/Users/username/scoop/apps/mpv/current:/c/Users/username/AppData/
Local/Programs/Python/Python312/Scripts:/c/Users/username/AppData/Local/Programs/Python/Python312:/c/Users/username/scoop/apps/gsudo/current:/c/Users/username/scoop/apps/imagemagick/current:
/c/Users/username/scoop/apps/maven/current/bin:/c/Users/username/scoop/apps/latex/current/texmfs/install/miktex/bin/x64:/c/Users/username/scoop/apps/ant/current/bin:/c/Users/username/.p
yenv/pyenv-win/bin:/c/Users/username/.pyenv/pyenv-win/shims:/c/Users/username/scoop/shims:/c/Users/username/AppData/Local/Microsoft/WindowsApps:/c/Program Files (x86)/SSH Communications Secu
rity/SSH Secure Shell:/c/Program Files/JetBrains/IntelliJ IDEA Community Edition 2020.3.1/bin:/c/Users/username/.dotnet/tools:/c/Program Files/multimonitortool-x64:/c/Program Files/nvim-win64:/c/tools
/neovim/nvim-win64/bin:/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin:/c/Program Files/KeePassXC:/c/Users/username/go/bin:/c/Program Files/SumatraPDF:/c/ProgramData/nvm:/c/Program Files
/nodejs:/c/Users/username/AppData/Local/Coursier/cache/arc/https/github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_windows_hotspot_8u292b10.zip/jdk8u292-b10/bi
n:/c/Users/username/AppData/Local/Coursier/data/bin:/c/Users/username/AppData/Local/Microsoft/WindowsApps:/c/Program Files/JetBrains/IntelliJ IDEA Community Edition 2023.2.4/bin:/c/Users/KhanY_z2
3jg7i/AppData/Local/Programs/oh-my-posh/bin:/c/Program Files/Neovim/bin:/c/Users/username/go/bin:/c/Users/username/AppData/Roaming/npm:/c/Users/username/programs:/c/Users/username/progr
ams/pgsql/bin:/c/Users/username/.jdks/openjdk-17.0.2/bin:/c/Users/username/AppData/Local/Programs/Microsoft VS Code/bin:/c/users/khany_z23jg7i/.local/bin:/c/Users/username/programs/focus:/c/
Users/username/programs/ctags:/usr/bin/vendor_perl:/usr/bin/core_perl:/scoop/shims:/scoop/shims


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123438545@github.com>

Enno

unread,
May 21, 2024, 5:28:23 PMMay 21
to vim/vim, Subscribed

You might have better chances with export PATH=$PATH:"$USERPROFILE/scoop/shims" in ~/.bashrc (or $HOME).
If neither $USERPROFILE, nor $HOME, then /c/Users/username.
Maybe let $BASH_ENV = $HOME.'/.bashrc' is needed as well. By the way, I thought rather /.bash_profilethan/.bashrc` to be read by Git Bash MSYS2, so maybe also MSYS2 itself?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123470680@github.com>

ykhan21

unread,
May 21, 2024, 5:33:08 PMMay 21
to vim/vim, Subscribed

When I add the export ~/.bashrc, MSYS picks it up fine as evidenced by which fzf in MSYS. However, MSYS vim's executable() function does not pick it up.

I will try the other PATH recommendations and report back later.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2123476365@github.com>

D. Ben Knoble

unread,
May 22, 2024, 9:03:01 AMMay 22
to vim/vim, Subscribed

It looks like tilde-expansion was not performed in the broken case; compare ~/scoops/shim with c:/users/username/scoops/shim


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2124745129@github.com>

Enno

unread,
May 22, 2024, 9:32:44 AMMay 22
to vim/vim, Subscribed

Yes, in terms of robustness: /c/Users/username > $HOME/USERPROFILE > ~/, from experience.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2124809126@github.com>

ykhan21

unread,
May 22, 2024, 10:21:26 AMMay 22
to vim/vim, Subscribed

Thanks. /c/users/username, $HOME, and $USERPROFILE worked as opposed to the ~.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2124926353@github.com>

Christian Brabandt

unread,
May 22, 2024, 10:29:33 AMMay 22
to vim/vim, Subscribed

Closed #14823 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/14823/issue_event/12895560747@github.com>

Christian Brabandt

unread,
May 22, 2024, 10:29:34 AMMay 22
to vim/vim, Subscribed

So I guess this is not a Vim issue but rather a bash/msys particularity. Let's close it then.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14823/2124946284@github.com>

Reply all
Reply to author
Forward
0 new messages