This should do the trick:
function run_info() { # Prepend "info" to the command line and run it. BUFFER="info $BUFFER" zle accept-line } # Define a widget called "run_info", mapped to our function above. zle -N run_info # Bind it to ESC-i. bindkey "^[i" run_info
Just paste this into your shell to try it out and add a permanent effect to your .zshrc.
To rephrase the code: the general idea is that we first define a widget called "run_info" implemented using a function with the same name. It takes a command line buffer and adds "info" to the beginning. Then it accepts the command line (similar to pressing Enter ). Finally, the widget is displayed on the keyboard.
You can read the zshzle (1) man page for more information on how this works.
source share