19

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 !

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
Ketan Deshmukh
  • 678
  • 1
  • 5
  • 9
  • 1
    try `export EDITOR=vim` – dpk2442 Oct 30 '13 at 18:50
  • possible duplicate of [How do I make git use the editor of my choice for commits?](http://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-commits) – cjc343 Oct 30 '13 at 18:53

2 Answers2

36

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

git config --global core.editor vim
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
StevenPatz
  • 478
  • 5
  • 7
2

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.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324