If you have accidentally press Alt+Number, you will see your Bash prompt become like:


(arg: 2)

If you press one or more digits, it could be like:


(arg: 234)

Since I started using Tmux from version 1.0, I saw this kind of prompt for probably 2 years. For Alt+2, it’s the key to change layout to horizontal split. I didn’t understand that prompt for such long time and I didn’t try to learn about it until now.

But I did know it must be Bash, so I checked out the manpage and found:


digit-argument (M-0, M-1, ..., M--)
Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative
argument.

To be honest, I didn’t understand how I could utilize this, I didn’t even know Readline accepts arguments. Well, actually I did when I search command history. Anyway, after few tests, I knew I could use it for repeating tasks.

One would be very helpful is deleting a word, which can be achieve by pressing Escape then Backspace. I have been using it a lot since I learned about it. (I think, I accidentally pressed at some time)

You can initialize digit-argument, then enter a keystroke, the keystroke will be repeated for N times. For example:


M-7, Backspace -> 7 letter before cursor will be deleted
M-80,Space -> 80 spaces will be inputed
M-3, Escape, Backspace -> 3 words before cursor will be deleted

I made a short video to demonstrate:

https://i.ytimg.com/vi/22W2nAIGNAo/sddefault.jpg

You can also use it for navigation, move forwards for a few words, or similar tasks.