aus*_*nbv 169 text-editor cron default-programs
我正在尝试将默认编辑器从 更改nano为vim.
我已经运行了以下命令:
sudo update-alternatives --config editor
和
update-alternatives --config editor
现在两者都输出:
Selection Path Priority Status
------------------------------------------------------------
0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
* 3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 10 manual mode
Run Code Online (Sandbox Code Playgroud)
我已经重新启动了我的 ssh 会话并重新启动了 sshd 但 crontab -e 仍然在 nano 中打开
我还需要做什么?
Mos*_*rdy 262
只需简单地运行select-editor,这将让您选择您想要的任何编辑器。
fos*_*dom 144
尝试您的 ssh 会话,然后
export EDITOR=vim
Run Code Online (Sandbox Code Playgroud)
或者可能
export EDITOR=/usr/bin/vim.basic
Run Code Online (Sandbox Code Playgroud)
EDITOR 变量的设置格式取决于您使用的 shell。
在 Ubuntu 中,您可以在登录时设置 EDITOR 环境变量,方法是将上述内容添加到 ~/.profile
您的 SSH 会话将读取远程主机上名为 ~/.ssh/environment. 这必须由 ssh 守护程序配置专门定义。查看man sshd_config并查找PermitUserEnvironment更多详细信息。
小智 27
我的个人喜好...
cd /bin
mv nano nano_must_die
ln -s /usr/bin/vim nano
Run Code Online (Sandbox Code Playgroud)
Luk*_*nga 27
如果只想临时选择编辑器,可以进行以下操作
EDITOR=nano crontab -e
Run Code Online (Sandbox Code Playgroud)
这EDITOR为命令设置环境变量
aur*_*mus 15
来自“man crontab”:
The -e option is used to edit the current crontab using the editor
specified by the VISUAL or EDITOR environment variables. After you
exit from the editor, the modified crontab will be installed automati?
cally. If neither of the environment variables is defined, then the
default editor /usr/bin/editor is used.
Run Code Online (Sandbox Code Playgroud)
也许您已将 EDITOR 环境变量设置为 nano?
小智 14
在我的 Ubuntu 12.04 计算机上,crontab使用~/.selected_editor包含所选编辑器路径的文件。编辑它:
nano ~/.selected_editor
Run Code Online (Sandbox Code Playgroud)
我直接编辑过或使用过select-editor,这是一个执行相同操作的脚本。编辑以下行:
SELECTED_EDITOR="/usr/bin/vim.basic"
Run Code Online (Sandbox Code Playgroud)
IHMO 人员不应更改 /etc 或 /bin 中的任何内容来执行此操作。这是用户级别的事情,而不是系统范围的任务。
| 归档时间: |
|
| 查看次数: |
213620 次 |
| 最近记录: |