ESC + { : 它是什么,我可以在哪里了解更多信息?

Pre*_*rem 32 command-line bash keyboard-shortcuts line-editor

我在 bash 提示符下播放,按 ESC 后跟 { ,然后,shell 显示所有文件以供完成,在 fileglob 字符串中。例如:如果我输入bash C后跟ESC+{,shell 将显示:bash CHECK{,1,2{,23{336{,66666},6},3{,6}}}自动完成所有以 C 开头的可能文件和目录,显示我创建的所有实验文件和目录。

什么是ESC + {以及我可以在哪里了解更多信息?

我在 CENTOS 和 Mac OSX 上用 bash 看到了这个。

Sté*_*las 49

了解键绑定。

bash

$ bind -p | grep -a '{'
"\e{": complete-into-braces
"{": self-insert

$ LESS='+/complete-into-braces' man  bash
   complete-into-braces (M-{)
          Perform filename completion and insert the list of possible com?
          pletions  enclosed within braces so the list is available to the
          shell (see Brace Expansion above).
Run Code Online (Sandbox Code Playgroud)

或与info

info bash --index-search=complete-into-braces
Run Code Online (Sandbox Code Playgroud)

(或info bash使用索引完成(i键))

但是请注意,bash-4.3 源附带的预构建信息页面至少缺少一些索引条目,包括 for complete-into-braces,因此除非您的操作系统从 texinfo 源重建信息页面,否则上述命令将不起作用。

zsh

$ bindkey| grep W
"^W" backward-kill-word
"^[W" copy-region-as-kill
$ info --index-search=copy-region-as-kill zsh
copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
 Copy the area from the cursor to the mark to the kill buffer.

 If called from a ZLE widget function in the form 'zle
 copy-region-as-kill STRING' then STRING will be taken as the text
 to copy to the kill buffer.  The cursor, the mark and the text on
 the command line are not used in this case.
Run Code Online (Sandbox Code Playgroud)

或者man假设less寻呼机如下bash

LESS='+/copy-region-as-kill' man zshall
Run Code Online (Sandbox Code Playgroud)

zsh还有一个describe-key-briefly可以绑定在键或键序列上,如下Ctrl+XCtrl+H所示:

bindkey '^X^H' describe-key-briefly
Run Code Online (Sandbox Code Playgroud)

然后您键入Ctrl+XCtrl+H后跟键或组合键来描述。例如,键入Ctrl+XCtrl+H两次将显示在提示下方:

"^X^H" is describe-key-briefly
Run Code Online (Sandbox Code Playgroud)

tcsh

zsh除了tcsh没有信息页面之外,这与基本相同。

> bindkey | grep -a P
"^P"           ->  up-history
"^[P"          -> history-search-backward
> env LESS=+/history-search-backward man tcsh
[...]
Run Code Online (Sandbox Code Playgroud)

fish

> bind | grep -F '\ec'
bind \ec capitalize-word
> help commands
Run Code Online (Sandbox Code Playgroud)

这应该启动您首选的网络浏览器。并capitalize-word在那里搜索。