Change your default terminal editor

less than 1 minute read

TL;DR: set BUNDLER_EDITOR, GEM_EDITOR, EDITOR, VISUAL to your favorite text editor, i.e.:

export VISUAL='nvim -n'
export EDITOR='nvim -n'
export BUNDLER_EDITOR='nvim -n'
export GEM_EDITOR='nvim -n'

The rubygems gem open command will look for $EDITOR, $VISUAL, and $GEM_EDITOR. The bundler bundle open command will look for $EDITOR, $VISUAL, and $BUNDLER_EDITOR. If you don’t want to think about which editor will open, just set them all into one part of your rc file.

Seems for most command line tools that requires some editor at some point (e.g. git commit), it will typically look for $VISUAL and/or $EDITOR as well. So setting them both seems to be a good default.

One more thing: I just learned that the rc in .bashrc, .zshrc files and the like means Run Command. If you’re into history, here’s a short historical reference of the said abbreviation.

Tags:

Categories:

Updated: