为 crontab -e 设置编辑器,为什么总是使用基本的 vim?

为 crontab -e 设置编辑器,为什么总是使用基本的 vim?

crontab -e当以 形式发出时root,我总是收到如下消息(部分),但是,vim直接执行完全没有问题。 $EDITOR已设置vim/root/.bash_profile

%> 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:

答案1

当您使用“sudo 命令”时,不会加载 root 用户配置文件,请改用sudo -icrontab -e

答案2

在 ubuntu-14.04 中,选择select-editor“vim-gnome”而不是“vim-basic”

相关内容