Tell me more ×
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
just export EDITOR=vim in your bashrc or zshrc or ..rc – Kent Apr 23 at 23:31
often must be set up for programs in addition to this such as git – timpone Apr 24 at 0:39

migrated from stackoverflow.com Apr 24 at 0:43

2 Answers

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. 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
export EDITOR=$VISUAL
share|improve this answer

Drop it in your home directory .bash_profile

share|improve this answer

Your Answer

 
discard

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