如何在 Git Bash 中的 Vim 中添加 Python 支持?

How do I add Python support in Vim in Git Bash?

我想在Git BashVim中添加Python支持,我该怎么做?

当 运行:

时我得到 false
:echo has('python')

您可以在 git bash 会话

中添加 python.exe 的路径
# move to $HOME first
cd
echo 'export PATH="$PATH:/c/Python27"' > .profile

那么Vim会更有可能检测到python。

确保使用最新的git for Windows release

TL;DR: Install MSYS2 instead, a "superset" of git bash, that also comes with a package manager.


此工单出现 in the git-for-windows issue tracker,并已关闭,原因如下:

This function is not required for Git for Windows to work. In fact, Python is not required for Git for Windows to work, therefore we do not ship it to the end user.

The purpose of Git for Windows is really to bring Git to Windows.

While that implies that we have to ship quite a few Unix-like tools, it does not mean that we will include such tools unless they are needed for Git's own operations, or at least for historical reasons (needs of active contributors are sometimes a factor in deciding whether to include a tool or not).

Having said that, what you really are looking for is MSYS2. Git for Windows leverages MSYS2 and ships with a subset of its files. MSYS2 even sports a package management system called "pacman" to install more tools (including Git...), so why don't you give it a whirl?

我想您可以在 Python 支持下继续重新安装或重新编译 vim,建议的做法似乎更好。