没有 Emacs,Bash 命令行编辑如何在 Emacs 模式下工作?

Without Emacs, how does Bash command line editing work in Emacs mode?

我的Linux系统没有安装Emacs,Bash命令行编辑默认模式仍然是Emacs。如果没有 Emacs,这是如何工作的?

我试图搜索Bash源代码,但仍然无法理解。 Bash 自身是否集成了 Emacs?

$ set -o
allexport       off
braceexpand     on
emacs           on
: :
vi              off
xtrace          off

GNU(1) readline 库是 bash(以及选择使用它的任何其他交互式输入系统)的繁重工作).

如果您想了解它的工作原理,那是您应该查看的源代码。

readline 个包是 hosted alongside bash


(1) 是的,相同 GNU 负责 emacs 编辑器。

对 emacs 的引用与 emacs 编辑器本身关系不大。它指的是 bash 使用的 GNU readline 库使用的键绑定 'style'。 Readline 支持两种按键绑定模式——emacs 风格和 vi 风格。默认通常是 emacs 风格。 readline 库非常强大,但老实说,在 Linux 使用 25 年的时间里,我从来没有为大多数高级功能烦恼过,甚至从未尝试过 vi 模式(即使 VI 是我的默认编辑器).

阅读 bash 手册中有关 readline 的部分了解更多详细信息。