git commit error saving vimfiles

六眼飞鱼酱① 提交于 2019-12-23 13:16:30

问题


I am following the easy git guide at nettuts easy git guide

I initialised an empty git instance in my ~/ directory and then added my .vimrc and my .vim/ files.

git add .vimrc
git add .vim

However when I do the git commit command I end up with what seems unrelated error messages.

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

If I press enter I get taken to a file. What am I doing wrong with this.

EDIT: have removed virtualenv ref from .vimrc. Never noticed the error because i was using gvim which never dislpayed the error.


回答1:


When you run git commit without specifying a commit message on the command line, it will launch an editor (in your case vim) so that you can enter one. Those errors that you see are from vim, reporting that you have errors in your .vimrc file. You should get the same errors if you just launch vim normally.




回答2:


Your vim installation does not have python support. If you run the command

vim --version | grep python

you should see +python, otherwise it means python is missing from the vim installation.




回答3:


This happens because git commit choose the editor 'vi'.
You can setting it to use 'vim', with command:

git config --global core.editor "vim"


More detials can be found [here]:How do I make Git use the editor of my choice for commits?



来源:https://stackoverflow.com/questions/8710285/git-commit-error-saving-vimfiles

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