Force crontab editor :: default editor
-
Many times you type:
crontab -eAnd end up with key bindings your not used to. (h,j,k,i) As in vi or ed.
Say you normally use nano:
export VISUAL=nano; crontab -eBoom, crontab will open and nano will be your editor.
Same goes for vi:
export VISUAL=vim; crontab -e
Then again maybe you want to use your preferred editor always, or as default.
Get a list of available editors currently install on your system by running:
update-alternatives --list editorIn this case, the output is:
/bin/ed /bin/nano /usr/bin/vim.gnome /usr/bin/vim.tinySo you may combine the above for on demand usage such as:
export VISUAL=ed; crontab -eOr:
export VISUAL=vim.gnome; crontab -eect…
To make one specific editor default to your users profile, you must edit:
~/.profileSo for example if your enjoying the ease of nano:
nano ~/.profileAnd add these lines as follows:
EDITOR=nano VISUAL=$EDITOR export EDITOR VISUALReplacing in the above case ‘nano’ with your desired default editor.
When you run the following as root, you are changing the default editor system wide, or all users. In this case, we can use ‘editor’, to see which editors are currently available on the system, as well as priorities, paths, and status:
update-alternatives --config editorThe output will be:
Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/vim.gnome 60 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/vim.gnome 60 manual mode 4 /usr/bin/vim.tiny 10 manual mode Press enter to keep the current choice[*], or type selection number:Then simply type the number of the default system wide editor you wish.
































