Docu review done: Mon 06 May 2024 09:51:33 AM CEST

crontab opens with nano

if the crontab -e opens with nano and you have set already the update-alternative --config editor to something lese

$ update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor
  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/vim.gtk     50        auto mode
  1            /bin/nano            40        manual mode
* 2            /usr/bin/vim.basic   30        manual mode
  3            /usr/bin/vim.gtk     50        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 2

check in the home dir of the use if the file .selected_editor exists:

$ cat ~/.selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/nano"

if yes, remove it and you will get asked to select an editor:

$ crontab -e

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/vim.tiny

Choose 1-3 [1]: 2
crontab: installing new crontab

OR you can also change the content of ~/.selected_editor to:

# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/nano"

if that still not helps, check the variables VISUAL and EDITOR

These can be set anywhere, e.g. the profile, bashrc… and remove them

$ export | grep -E "(VISUAL|EDITOR)"

After that, it will be vim again ;)