[Bug 13611] New: Please add M-. (yank-last-arg) to busybox sh (libbb/libedit.c)

bugzilla at busybox.net bugzilla at busybox.net
Thu Mar 11 09:45:20 UTC 2021


https://bugs.busybox.net/show_bug.cgi?id=13611

            Bug ID: 13611
           Summary: Please add M-. (yank-last-arg) to busybox sh
                    (libbb/libedit.c)
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: trentbuck+busybox-sold-my-email-address at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

In readline (bash, python, cmucl, mysql, &c) as well as ^P (Ctrl+P) changing
the input line to the previous command, there is also M-. (Alt+.) to insert the
last argument of the previous command.

This is super handy for cases like this:

  ls foo
  ls foo/bar
  ls foo/bar/*.txt
  rm -rf foo/bar/*.txt

In each of those cases, you can type M-. to avoid typing the path out.
When the path is very long, this avoids having to spam "cd" or do a lot of
left/right/backspace editing.

I had a quick look and it looks like this would be a variant of
libbb/libedit.c:get_previous_history.

My C-fu isn't quite up to actually creating a proof-of-concept patch, sorry.


PS: in libreadline you can also do M-3 M-. to insert the third-last argument
(e.g. "echo foo bar baz RET M-3 M-." would insert "foo").
You can also type M-. repeatedly to go back further in history, like C-p (e.g.
"echo x RET echo y RET M-. M-." would insert "x").
These extras are nice-to-have but not nearly as useful as M-. alone.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list