Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where.

How can I set "vi" as my default editor?

share|improve this question

migrated from stackoverflow.com Apr 24 '13 at 0:43

This question came from our site for professional and enthusiast programmers.

just export EDITOR=vim in your bashrc or zshrc or ..rc –  Kent Apr 23 '13 at 23:31
often must be set up for programs in addition to this such as git –  timpone Apr 24 '13 at 0:39

2 Answers 2

up vote 19 down vote accepted

You should add it to your shell’s configuration file. For Bash, this is ~/.bashrc or ~/.bash_profile. You should also set $VISUAL, as some programs (correctly) use that instead of $EDITOR (see VISUAL vs. EDITOR). Additionally, unless you know why, you should set it to vim instead of vi.

TL;DR, add the following to your shell configuration (probably ~/.bashrc):

export VISUAL=vim
share|improve this answer

Drop it in your home directory .bash_profile

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.