4

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.

5
  • This problem is related with you /home/sayth/.vimrc. Paste it so we can comment Commented Jan 3, 2012 at 9:44
  • my vimrc is probably too long to paste here. Edit above I removed the offending virtualenv section from the vimrc Commented Jan 3, 2012 at 12:38
  • You can past your .vimrc to e.g. gist.github.com and link to it. Commented Jan 3, 2012 at 13:01
  • for reference my vimrc is here github.com/flebber/MyVim/blob/master/.vimrc Commented Jan 3, 2012 at 13:01
  • For reference, I had this problem (errors when vim started from git, but not normally) on a server, although not python related. I was getting errors about "no mouse support", "cannot find colour scheme", etc. This was because the (oldish) system was running Vim 7.0, and so I had compiled vim 7.3 in my home directory, and was using that. Git, on the other hand, appears to use the system vim (confimed by checking :version). This is pretty annoying. It can be fixed by forcing git to use your self-compiled version: git config --global core.editor '~/bin/vim' Commented Jun 26, 2012 at 4:34

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Removed section from vimrc, then comitted with git commit -am 'first commit' which seems to have worked.
I'm getting vim errors that I don't get if I launch vim normally. Both occur inside a function declaration - as if it's attempting to execute the function, even though my vimrc never calls it. Is it possible that git is calling a different Vim that somehow doesn't support functions? Or is something else going on?
3

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.

1 Comment

sayth@linux-kt34:~> vim --version | grep python +persistent_undo +postscript +printer +profile -python -python3 +quickfix
2

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.