Eri*_*son 6 configuration text-editor emacs gnome-terminal
我喜欢使用 emacs 作为我的配置编辑器,因此它是git
或 之类的程序的默认设置cron
。所以我用
sudo update-alternatives --config editor
Run Code Online (Sandbox Code Playgroud)
并从列表中选择 emacs24。
与 Vim 或 nano 不同,这会将 emacs 作为新的 gui 应用程序启动,而不是接管当前的终端窗口。
有没有办法让 emacs 在终端中作为配置编辑器打开,或者当它从命令行调用时,但仍然允许从启动器或破折号启动 emacs 作为独立应用程序?
来自@steeldriver 评论:
git config --global core.editor "emacs -nw"
Run Code Online (Sandbox Code Playgroud)
大多数实用程序,包括git
名为 EDITOR 的环境变量,您可以将其设置为您想要的任何编辑器,包括选项。 export EDITOR='emacs -nw'
让他们在非窗口模式下运行 emacs。
就 而言emacs
,它有一个方便的服务器模式,您可以从它开始M-x server-start
,然后emacsclient
作为编辑器运行以在已运行的 emacs 实例中打开文件。这很方便,因为它允许您保留对 emacs Kill Ring 和其他功能的访问权限。它还接受-nw
开关,以便它将在终端窗口而不是在 gui emacs 框架中打开一个新的 emacs 框架,因此它看起来和感觉起来仍然像文本模式 emacs 会话,但仍然与其他窗口。