Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (29.3k points)

I would prefer to write my commit messages in Vim, but it is opening them in Emacs.

How do I configure Git to always use Vim? Note that I want to do this globally, not just for a single project.

1 Answer

0 votes
by (50.2k points)
edited by

If you want to set the editor only for Git 

Set core.editor in git config: git config --global core.editor "vim"

Set the git-editor environment variable to export GIT_EDITOR=vim

If you need to set editor not only for git but also for other programs use following standardized visual and editor environmental variables 

export VISUAL=vim


For sublime text: add the following to git.config file


    editor = 'subl' --wait

--wait is compulsory which allows you to type and will wait to save/close the event.

For more information please go through the following tutorial to get more info about git:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories