32

I was play around at the bash prompt, and pressed ESC followed by { , after which , the shell showed all the files for completion, in a fileglob string. Eg : If I had typed bash C followed by ESC+{ , the shell would show this : bash CHECK{,1,2{,23{336{,66666},6},3{,6}}} auto-completing all the Possible files & Directories starting with C, showing all the Experimental files & Directories I had made.

What is ESC + { & where I can know more about it ?

I see this on CENTOS & Mac OSX with bash.

49

To find out about a key binding.

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

Or with info:

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

(or info bash and use the index with completion (i key))

However note that the pre-built info page that comes with bash-4.3 sources at least is missing some index entries including that for complete-into-braces, so unless your OS rebuilds the info page from the texinfo sources, the above command won't work.

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

Or with man assuming the less pager like for bash:

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

zsh also has a describe-key-briefly which you can bind on a key or key sequence, like Ctrl+XCtrl+H below:

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

Then you type Ctrl+XCtrl+H followed by the key or key combination to describe. For instance, typing that Ctrl+XCtrl+H twice would display below the prompt:

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

In tcsh

That's basically the same as zsh except that tcsh doesn't have an info page.

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

In fish:

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

Which should start your preferred web browser. And search for capitalize-word in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.