Change default text editor for crontab to vim

The crontab -e command will check the environment variables $EDITOR and $VISUAL for an override of the default text editor, so...

export VISUAL=vim

or

export EDITOR=vim

should do the trick.


In ubuntu, try run: select-editor, which interactively creates ~/.selected_editor:

# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vim.basic"

If you hate nano so much you can just uninstall it:

sudo apt-get remove nano

crontab should then just default to the next EDITOR (for me it was vim.basic).