When I type Alt-x, execute: will pop up:

~ % 
execute: _

And I can continue type(space has no effect):

~ %        
execute: what'sthis

Q1: what's this promotion for?

Q2: How can i modify this shortcut to other key-binding? Because M-x in emacs is quite useful, and i use shell in emacs often, so the two conflict.

I have google for hours, but still have no answers(maybe my keywords are not correct--google: "zsh" + "excute:", "google: zsh keybinding bindkey

  • 2
    Instead of using an advertising search engine for hours, read the Z shell user manual. The information in M. Chazelas's answer is all in there, M. Chazelas even referring you directly to some of it, and can be found in a far shorter time than "hours".
    – JdeBP
    Commented Apr 26, 2018 at 17:48
  • Thanks for your advice :) I also find RTFM is quite worthwhile yesterday.
    – Chen Li
    Commented Apr 27, 2018 at 3:39

1 Answer 1


If you do:

bindkey | grep -F '^[x'

or simply:

bindkey '^[x'

or if in doubt about how to express Alt+x:

bindkey | grep -w x

You'll see:

"^[x" execute-named-cmd

That's the name of the widget bound to ESC x and most terminals send the ESC x character sequence upon pressing Alt+x

info zsh execute-named-cmd

Will tell you what that widget does (you may need to install the zsh-doc package on some systems).

As the name suggests, it prompts for a command to execute. Commands here being zsh widgets, editor commands. That's the equivalent of emacs' Meta-x, except that it's zsh editor commands instead of emacs command (the command is called execute-extended-command in emacs)

For instance, if at that prompt, you type backward-delete-char and press Return, it will invoke that widget which by default is bound to Backspace. You can do exactly the same in emacs.

If instead, you type descTab (Tab for completing it into describe-key-briefly, a widget not bound to any key by default, and also found in emacs) and press Return, you'll see another prompt:

Describe key briefly: _

Where you can press, say, Alt+x to see what that's bound do. You'd then get:

"^[x" is execute-named-cmd

If you do the same in emacs, you'll see:

M-x runs the command execute-extended-command

To see the list of widgets, run zle -al, zle -l for the non-builtin ones, bindkey to list the key bindings.

You can bind Alt+x to something else with

bindkey "^[x" some-widget
  • 1
    There's no need to grep the output of bindkey. bindkey '^[x' also works.
    – JdeBP
    Commented Apr 26, 2018 at 17:50
  • @JdeBP, good point. See edit. Commented Apr 26, 2018 at 18:48
  • bindkey "^[^x" worked for me.
    – strboul
    Commented Feb 18, 2022 at 10:42
  • @strboul. Weird. What terminal emulator are you using? Commented Feb 19, 2022 at 18:30
  • @StéphaneChazelas sorry, correcting myself. ^[x works not ^[^x.
    – strboul
    Commented Feb 20, 2022 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .