保存vimfiles的git commit error

时间:2012-01-03 09:41:57

标签: git vim

我正在关注nettuts easy git guide

上的简单git指南

我在~/目录中初始化了一个空的git实例,然后添加了我的.vimrc和我的.vim/文件。

git add .vimrc
git add .vim

然而,当我执行git commit命令时,我最终得到了似乎无关的错误消息。

sayth@linux-kt34:~> git commit
Error detected while processing /home/sayth/.vimrc:
line  203:
E319: Sorry, the command is not available in this version: py << EOF
line  204:
E492: Not an editor command: import os.path
line  205:
E492: Not an editor command: import sys
line  206:
E492: Not an editor command: import vim
line  207:
E15: Invalid expression: 'VIRTUAL_ENV' in os.environ:
line  224:
E171: Missing :endif
Press ENTER or type command to continue

如果我按回车键,我会被带到一个文件中。我做错了什么。

编辑:已从.vimrc删除了virtualenv ref。从来没有注意到这个错误,因为我使用的gvim从来没有错过错误。

3 个答案:

答案 0 :(得分:5)

当您在命令行上未指定提交消息的情况下运行git commit时,它将启动编辑器(在您的情况下为vim),以便您可以输入一个。您看到的这些错误来自vim,报告您的.vimrc文件中存在错误。如果您只是正常启动vim,则会出现相同的错误。

答案 1 :(得分:3)

您的vim安装没有python支持。如果您运行命令

vim --version | grep python

你应该看到+python,否则就意味着vim安装中缺少python。

答案 2 :(得分:0)

发生这种情况是因为git commit选择了编辑器“ vi”。
您可以通过以下命令将其设置为使用“ vim”:

git config --global core.editor "vim"


可以在[此处]找到更多详细信息:How do I make Git use the editor of my choice for commits?

相关问题