When you're in command mode in vi
(the the actual editor or the Bash mode), pressing digits inputs an argument (hence "arg") that is usually used to set the number of repetitions to perform the following command. To avoid that, you should be in input mode (by pressing i for example) before pressing digits.
Demonstration:
If you're not in vi mode, you can enter it using:
set -o vi
(You can exit vi mode by entering emacs mode: set -o emacs
)
Now, in vi input mode type a command like this:
echo abcdefghijk4
You'll notice that you get a digit "4" at the end just as shown above.
Now press Esc. The cursor will move one character to the left and you're now in command mode.
Press a digit, let's say "3". Now you'll see this:
(arg: 3) echo abcdefghijk4
Now press capital X. You should see:
echo abcdefgh4
Three characters ("ijk") have been deleted because you told Readline (Bash's command-line input editor) to "rubout" 3 characters.
Now press i and any digit. The digit was inserted in the command line at the point where the cursor was.
bash
doesn't have many configuration options forvi
mode. I recently started usingzsh
and was pleased to find that thevi
mode there doesn't do this. Also there are more options for configuring a command/insert mode indicator. – Graeme Apr 16 '14 at 16:22