It should be possible to do that by having ALT+UP generate consecutive keyboard input equivalent to cdspace..ENTER by means of a macro definition. But can't figure out how exactly to do it.
To do literally what you're asking, put the following line in your
In bash, you can in principle bind a key to shell code, so in theory this should work:
However as of bash 4.2 it doesn't work due to a hard-to-fix implementation bug. Zsh expert Stéphane Chazelas has a workaround:
The effect is somewhat confusing because the prompt isn't redrawn.
In bash ≥4, add
|show 4 more comments|