# How can I set "vi" as my default editor in UNIX?

I think I can do something like export EDITOR=vi, yet I'm not exactly sure just what to enter, and also where.

Just how can I set "vi" as my default editor?

209
2022-07-14 02:16:51
Source Share

You need to add it to your shell' s arrangement documents. For Bash, this is ~/.bashrc or ~/.bash_profile. You need to additionally set $VISUAL, as some programs (appropriately) make use of that as opposed to $EDITOR (see VISUAL). In addition, unless you recognize why, you need to set it to vim as opposed to vi.

TL ;DR, add the complying with to your shell arrangement (possibly ~/.bashrc) :

export VISUAL=vim
export EDITOR="\$VISUAL"

253
2022-07-14 04:14:26
Source

If bash is your shell, after that insert it right into .bash_profile in your house directory site ; if zsh is your shell, after that insert it right into .zprofile ; for various other coverings see the according documents.

7
2022-07-14 04:14:19
Source