Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead?

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 !

like image 472
Ketan Deshmukh Avatar asked Oct 30 '13 18:10

Ketan Deshmukh


2 Answers

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

git config --global core.editor vim
like image 198
StevenPatz Avatar answered Nov 03 '22 04:11

StevenPatz


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.

like image 28
Ingo Karkat Avatar answered Nov 03 '22 06:11

Ingo Karkat