bash 如何在bash中打开emacs

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8746227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 21:26:39  来源:igfitidea点击:

How to open emacs inside bash

bashemacs

提问by jyriand

I'm using Ubuntu 11.10. When I type command "emacs" in terminal, it opens emacs as a seperate window. How can I open it inside the terminal, like nano editor?

我正在使用 Ubuntu 11.10。当我在终端中输入命令“emacs”时,它会打开 emacs 作为一个单独的窗口。如何在终端内打开它,比如 nano 编辑器?

回答by Jeff Foster

Emacs takes many launch options. The one that you are looking for is emacs -nwthis will open emacs inside the terminal disregarding the DISPLAY environment variable even if it is set. The long form of this flag is emacs --no-window-system.

Emacs 有许多启动选项。您正在寻找的是, emacs -nw即使设置了 DISPLAY 环境变量,这也会在终端内打开 emacs。此标志的长格式是emacs --no-window-system.

More information about emacs launch options can be found in the manual.

有关 emacs 启动选项的更多信息可以在手册中找到。

回答by topskip

Just type emacs -nw. This won't open an X window.

只需键入emacs -nw. 这不会打开 X 窗口。

回答by user2820579

In the spirit of providing functionality go to your .profileor .bashrcfile located at /home/usr/and at the bottom add the line:

本着提供功能的精神,转到位于底部和底部的文件.profile.bashrc文件,/home/usr/添加以下行:

alias enw='emacs -nw'

Now each time you open a terminal session you just type, for example, enwand you have with three letters the emacs no-window option :).

现在,每次打开终端会话时,您只需键入,例如,enw您就拥有三个字母的 emacs 无窗口选项:)。

回答by speeves

If you need to open EMACS without X:

如果您需要在没有 X 的情况下打开 EMACS:

emacs -nw

回答by Eric Ihli

I didn't like the alias solution for my purposes. For one, it didn't work for setting export EDITOR="emacs -nw".

我不喜欢别名解决方案用于我的目的。一方面,它不适用于设置export EDITOR="emacs -nw".

But you can pass --without-xto configure and then just regular ol' emacswill always open in terminal.

但是您可以传递--without-x给配置,然后常规 ol'emacs将始终在终端中打开。

curl http://gnu.mirrors.hoobly.com/emacs/emacs-25.3.tar.xz
tar -xvzf emacs-25.3.tar.xz && cd emacs-25.3
./configure --without-x
make && sudo make install

回答by user2497

Try emacs —daemonto have emacs running in the background, and emacsclientto connect to the emacs server.

尝试emacs —daemon让 emacs 在后台运行,并emacsclient连接到 emacs 服务器。

It's not much time overhead saved on modern systems, but it's a lot better than running several instances of emacs.

在现代系统上节省的时间开销并不多,但比运行多个 emacs 实例要好得多。

回答by muhe

emacs hello.c -nw 

this is to open a hello.c file using emacs inside the terminal

这是在终端内使用 emacs 打开一个 hello.c 文件

回答by adolflow

It can be useful also to add the option --no-desktopto avoid launching several buffers saved.

添加--no-desktop避免启动多个保存的缓冲区的选项也很有用。