+1 vote
1 view
in Devops and Agile by (28.1k 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 (48k 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

export EDITOR="$VISUAL"

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

[core]

    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
0 answers
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...