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

大兔子大兔子 提交于 2019-11-29 13:05:23

问题


I want to add Python support in Vim in Git Bash, how do I do this?

I get false when running:

:echo has('python')

回答1:


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


This ticket shows up in the git-for-windows issue tracker, and was closed with the following reason:

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?

I guess you could go ahead re-install or re-compile vim with Python support, a better course of action seems to be the one suggested.




回答2:


You can add the path to a python.exe in your git bash session

# move to $HOME first
cd
echo 'export PATH="$PATH:/c/Python27"' > .profile

Then Vim will be more likely to detect python.

Make sure to use the latest git for Windows release.



来源:https://stackoverflow.com/questions/33519853/how-do-i-add-python-support-in-vim-in-git-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!