linux 默认文本编辑器
On Linux, a default editor is used for text editing such as crontab -e
or git commit
. How to change it to the editor of my own choice?
在Linux上 ,默认编辑器用于文本编辑,例如crontab -e
或git commit
。 如何将其更改为我自己选择的编辑器?
The default editor is indicated by the EDITOR
environment variable. You can set this environment variable to set the default editor. For example, set it to emacs by EDITOR=emacs
.
默认编辑器由EDITOR
环境变量指示。 您可以设置此环境变量来设置默认编辑器。 例如,将其设置为emacs的由EDITOR=emacs
。
If you want to set it for all users, add this line to /etc/bashrc
or /etc/profile
:
如果要为所有用户设置它,请将此行添加到/etc/bashrc
或/etc/profile
:
export EDITOR=emacs
If you want to set it for yourself only, add this line to ~/.bashrc
or ~/.profile
:
如果只想自己设置,请将此行添加到~/.bashrc
或~/.profile
:
export EDITOR=emacs
If you want to set it for one shell instance only, run this:
如果仅要将其设置为一个shell实例,请运行以下命令:
export EDITOR=emacs
If you want to set it for just one instance of a program, say crontabe -e
, run this:
如果只想为一个程序实例设置它,例如crontabe -e
,请运行以下命令:
EDITOR=emacs crontab -e
翻译自: https://www.systutorials.com/how-to-change-the-default-text-editor-on-linux/
linux 默认文本编辑器