I am trying to tell my terminal to use vim instead of vi when editing crontab by executing
export EDITOR=vim. But closing the terminal and opening a new one just resets the session. How do I change that?
echo 'export EDITOR=vim' >> ~/.bashrc
-e Edits the current crontab using the editor specified by the VISUAL or EDITOR environment variables.
Therefore unfortunately there is no crontab specific
EDITOR setting, however, you could create an alias to invoke the
vim editor prior to editing your cron:
alias crontabvim="export EDITOR=vim;crontab $@"
$@ will apply all subsequent arguments to the
This can be saved in your
~/.bashrc file for session persistance.