How to get rid of "nano not found" warnings, without installing nano?

I found my own answer and so I'm posting it here, in case it helps someone else.

In the root user's home directory, /root, there was a file alled .selected_editor, which still retained this content:

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

The content suggests that the command select-editor is used to select a new editor, but at any rate, I removed the file (being in a bad mood and feeling the urge to obliterate something) and was then given the option of selecting the editor again when running crontab -e, at which point I selected vim.basic, and all was fine after that. The new content of the file reflects that selection now:

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

The generic Linux way to set the default editor is to set VISUAL shell variable to the desired editor. For example in .bashrc add line like this:

export VISUAL=/usr/bin/vi

This will set every time you login in to the system vi as visual editor


Another neat trick is to do update-alternatives and pick your preferred editor. This not only gives you the privilege to pick one but also let you see what editors are on your system:

update-alternatives --config editor

Result:

There are 3 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/nano            40        manual mode
  2            /usr/bin/vim.basic   30        manual mode
  3            /usr/bin/vim.tiny    10        manual mode

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

Then simply type the number of your preferred editor and hit the return key.

Tags:

Vim

Debian

Nano