In bash on OSX I can do ctrl-_
to undo what I most recently typed. Is there a corresponding redo command?
-
2I've done a quick look in readline(3) man page and I can't found nothing about redo command/short-cut. readline(3) is the library responsible by shortcuts and historic feature in bash. If you are interested, you could have a look at the manual here unixhelp.ed.ac.uk/CGI/man-cgi?readline+3. There are all defaults shortcuts listed in this man page.– Bruno CoimbraFeb 25, 2013 at 21:08
-
@BrunoCoimbra: looks like there might be nothing, but thanks for the reference.– amindfvMar 2, 2013 at 19:30
1 Answer
ctrl-y
is the Readline 'yank' command which retrieves the kill buffer. ctrl-u
kills from the point to the beginning of the line (similar to OSX/bash ctrl-_
which clears the whole line). The Emacs-like Readline bindings are enabled in bash and a subset are enabled in many other places (browser search bars etc).
ctrl-u
kill from start of line to insertion pointctrl-k
kill from insertion point to end of linectrl-w
kill previous word (and prepend to kill buffer)ctrl-y
yank contents of kill buffer
-
1I get different behavior (in Terminal in OS X and XTerm and Emacs in Fedora) -
ctrl-_
undoes whatever the last action was, and alsoctrl-y
retrieves any killed text, not just withctrl-u
. Still, I hadn't heard ofctrl-y
before - thanks!– amindfvFeb 25, 2013 at 22:24 -
Edited my answer to say 'Readline' rather than 'Emacs', although many key bindings are shared, also to broaden the kill buffer's definition. The Readline command
kill-whole-line
, which does the same as yourctrl-_
, is unbound by default - I'd always wondered if there's a kill-whole-line command. I usectrl-a-k
(beginning-of-line kill-line) to kill the whole line. Feb 25, 2013 at 22:42 -
7For me,
ctrl-_
doesn't kill the whole line, though -- it's an undo command– amindfvFeb 26, 2013 at 0:35 -
4