18

I am trying to add a commit message to my changes using

git commit -a 

OR just plain

git commit

this somehow opens GNU Nano 2.2.6 editor and I am not at all comfortable with it. So the question is :

How can I modify my settings so that it always opens with VIM ?

What I already have done is inserting following line in my ~/.bash_profile

set EDITOR = vim

Please help !

2

2 Answers 2

37

You can set it from the command line or in your .gitconfig

git config --global core.editor vim
Sign up to request clarification or add additional context in comments.

Comments

3

To make Vim the default editor for Git only, see HST's answer. However, you probably want to have Vim as the default for all applications.

That can be done by

export EDITOR=vim

in your ~/.bash_profile or ~/.bashrc. The key is the export, otherwise the setting won't inherit to launched processes, like Git is.

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.