gsi*_*011 15 emacs default-programs update-alternatives
编辑文件时sudoers
,我想使用 emacs 而不是 nano。所以我运行了这个命令
sudo update-alternatives --config editor
Run Code Online (Sandbox Code Playgroud)
And I selected emacs. The only issue is I like emacs in no window mode (the -nw flag) and I've aliased emacs as emacs='emacs -nw'
so that I can use no window mode in normal use, but I don't know how to get my default editor to be in no window mode.
In other words, I need to get the command sudo visudo
and similar commands that open up editors to open the file with emacs -nw
. How can I do this? I'm on Ubuntu 12.04.
创建一个以 -nw 标志启动 emacs 的脚本,例如 /usr/local/bin/emacs-nw。
#!/bin/sh
emacs -nw "$@"
Run Code Online (Sandbox Code Playgroud)
使用 update-alternatives --install 安装它。
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/emacs-nw 2
Run Code Online (Sandbox Code Playgroud)
将编辑器配置为您的新脚本。
sudo update-alternatives --set editor /usr/local/bin/emacs-nw
Run Code Online (Sandbox Code Playgroud)
将以下内容添加到您的~/.bashrc
文件(如果不是 Bash,则添加到您的 shell 的配置文件)。
export EDITOR="emacs -nw"
这应该设置(并导出)一个 env 变量,将您的默认编辑器设置为非图形模式下的 Emacs。
归档时间: |
|
查看次数: |
16361 次 |
最近记录: |