DEV Community 👩‍💻👨‍💻

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Make Vim Default Editor For Git and OS

I prefer to write my git commit messages in Vim instead of nano or emacs or anything. To set this 'globally', change your Git's core.editor:

$ git config --global core.editor "vim"
Enter fullscreen mode Exit fullscreen mode

If you also want to set Vim for other programs as well, set the standardized VISUAL and EDITOR environment variables in your terminal resource file (.zshrc, .bashrc, config.fish etc.)

export VISUAL=vim
export EDITOR="$VISUAL"
Enter fullscreen mode Exit fullscreen mode

All done!

P.S:

If you wonder why both VISUAL and EDITOR set, please look at : VISUAL vs EDITOR

Top comments (4)

Collapse
 
waylonwalker profile image
Waylon Walker

vim is an amazing piece of software.

Collapse
 
inemtsev profile image
Ilya Nemtsev

nvim is cool too :p

Collapse
 
waylonwalker profile image
Waylon Walker

Nvim is my daily driver

Collapse
 
serhatteker profile image
Serhat Teker Author

Couldn't agree more; the swiss army knife, the joy and the timeless software.

👀 Just want to lurk?

You can still create an account and turn on features like 🌚 dark mode.