Update VISUAL in .bashrc
Programs like git
expect VISUAL
to be set. Some other programs also expect EDITOR
to be set.
# for bash
echo 'export EDITOR=vim' >> ~/.bashrc
echo 'export VISUAL=vim' >> ~/.bashrc
# for zsh
echo 'export EDITOR=vim' >> ~/.zshrc
echo 'export VISUAL=vim' >> ~/.zshrc
# for fish
echo 'export EDITOR=vim' >> ~/.config/fish/config.fsh
echo 'export VISUAL=vim' >> ~/.config/fish/config.fsh
You can also use the full path to vim, which you can find with $(command -v vim)
.
my_vim="$(command -v vim)"
echo "export EDITOR=$my_vim" >> ~/.bashrc
echo "export VISUAL=$my_vim" >> ~/.bashrc
And, of course, if vim
isn`t already installed, you’ll need to install it:
sudo apt install -y vim
For All Users
I don’t like this method for two reasons:
- it requires
sudo
- it requires manual input
sudo update-alternatives --config editor