2

It looks like in bash it is alias-expand-line.

What is the bindkey command I can add to my .cshrc_custom file?

Sort of related: what is "^[y" referring to for a key bind? I know ^ is ctrl, but what is [?

Stuart
  • 1,733
  • 4
  • 21
  • 34

1 Answers1

7

Running man tcsh and searching for "alias" yields:

normalize-command (^X-?)
Searches for the current word in PATH and, if it is found, replaces it with the full path to the executable. Special characters are quoted. Aliases are expanded and quoted but commands within aliases are not. This command is useful with commands that take commands as arguments, e.g., ‘dbx’ and ‘sh -x’.

For example:

% alias hi echo hello
% hi

Typing Ctrl-X ? when the cursor is immediately after the hi expands it to echo hello. And since it's already bound, you don't necessarily need to touch your startup file (unless you want to change the binding).

One problem: It expands to the definition of the alias, not necessarily to what the alias would have expanded to. For example, given:

% alias echo2 'echo \!:2'

(which echos just its second argument), typing echo2 followed by Ctrl-X ? expands it literally to echo !:2.

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631