3

When issuing crontab -e as root , i always got messages like the following (partial) , however , executing vim directly doesn't have problems at all. $EDITOR was set to vim in /root/.bash_profile already.

%> sudo crontab -e
Error detected while processing /root/.vimrc:
line    2:
E319: Sorry, the command is not available in this version: autocmd! BufNewFile * silent! 0r ~/.vim/skel/tmpl.%:e
line   20:
E319: Sorry, the command is not available in this version: autocmd VimEnter * set vb t_vb=
line   57:
E518: Unknown option: autochdir
line   65:
E319: Sorry, the command is not available in this version: syn on
line   78:
E538: No mouse support: mouse=a
line   79:
E319: Sorry, the command is not available in this version: filetype plugin indent on
line   87:
E319: Sorry, the command is not available in this version: funct! CommentBlock(comment)
line   88:
daisy
  • 6,440
  • 16
  • 57
  • 76

2 Answers2

1

When you use "sudo command" the root user profile is not loaded, use sudo -i and crontab -e instead.

Kris Harper
  • 13,397
  • 12
  • 56
  • 73
João Pinto
  • 17,029
  • 5
  • 55
  • 68
  • no difference with `sudo -i crontab -e` – daisy Oct 16 '11 at 15:48
  • Sorry, I was not very clear, you need to: "sudo -i" ENTER, then contrab -e. "sudo -i command" will not load the root's .bashrc, that is why the EDITOR is not being properly set. – João Pinto Oct 17 '11 at 08:24
  • not work as well , also i tried to 'Default env_keep = EDITOR' with visudo , it's still not working , but 'sudo su -' , and then 'crontab -e' works – daisy Oct 17 '11 at 15:24
  • *[Running 14.04. Desktop LTS:]* Isn't there a simpler way than `$ sudo -i` followed by `$ crontab -e` followed by choosing yr editor of choice ? It seems that loading root's `.bashrc` when invoking `sudo + cmd` should be accessible to permanent configuration. Should not there be at least an option for that ? – Cbhihe Jan 12 '16 at 10:01
-1

in ubuntu-14.04, use select-editor choose "vim-gnome" but not "vim-basic"

shgy
  • 1
  • In 16.04 your options are 1. `/bin/ed`, 2. `/bin/nano` (recommended) and 3. `/usr/bin/vim.tiny`. – WinEunuuchs2Unix Dec 28 '16 at 04:22
  • The user is using the cli therefore suggesting to use vim-gnome would mean that he'd need the gnome libraries installed. They may not be available. – Mark D Oct 05 '18 at 15:48