ESC + {:这是什么?在哪里可以进一步了解?


32

我在bash提示下四处游玩,然后按ESC,再按{,然后,shell在fileglob字符串中显示了所有要完成的文件。例如:如果我键入bash C后跟ESC+{,则shell将显示以下内容:bash CHECK{,1,2{,23{336{,66666},6},3{,6}}}自动完成以C开头的所有可能的文件和目录,显示我制作的所有实验文件和目录。

什么是ESC + {什么?在哪里可以进一步了解?

我在带有bash的CENTOS和Mac OSX上看到了这一点。

Answers:


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).

或搭配info

info bash --index-search=complete-into-braces

(或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.

man假设less像这样的寻呼机bash

LESS='+/copy-region-as-kill' man zshall

zsh还具有describe-key-briefly您可以绑定到键或键序列上的,如下Ctrl+XCtrl+H所示:

bindkey '^X^H' describe-key-briefly

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

"^X^H" is describe-key-briefly

tcsh

zsh除了tcsh没有信息页面外,其他基本相同。

> bindkey | grep -a P
"^P"           ->  up-history
"^[P"          -> history-search-backward
> env LESS=+/history-search-backward man tcsh
[...]

fish

> bind | grep -F '\ec'
bind \ec capitalize-word
> help commands

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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.