Whenever you are in vi command mode on the shell and hit a number, like 8, "(arg: 8)" shows at the start of the line. Anyone know how to make it not do that? The moving the line I'm typing is distracting.

Instead of:

(arg: 8) somecmd --itslong --reallylong


somecmd --itslong --reallylong
  • A down vote? Why? – Justin Thomas Apr 15 '14 at 21:04
  • Maybe try and rephrase your question. You phrased it as a threat! – user3227965 Apr 15 '14 at 21:09
  • Why is it a threat? The tags? – Justin Thomas Apr 15 '14 at 21:13
  • 1
    @user3227965 What threat? I don't see any threat here. – Michael Hampton Apr 15 '14 at 21:18
  • 1
    Don't think there is any way to stop this outside of patching the source code - bash doesn't have many configuration options for vi mode. I recently started using zsh and was pleased to find that the vi 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

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.


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.

| improve this answer | |
  • 1
    Right, I know all this. I want it not to say (arg: 3) and just rubout the characters. The issue I have with the way it works is in a long command the command gets shifted to the right causing my eyes to refocus on what I'm typing. I know in that case it's going to repeat 3 because I typed 3. – Justin Thomas Apr 16 '14 at 3:38
  • 1
    @justinthomas: There was no indication in your question that you knew what I posted in my answer. There's not any way to do what you want. – Paused until further notice. Apr 16 '14 at 4:07
  • 1
    Really? I said how do I make it not do that. Though that should have been show the args. – Justin Thomas Apr 16 '14 at 6:10

The offending code is in: lib/readline/misc.c

Removing lines 109 and 241 will remove the message.

| improve this answer | |

You can rebind the number keys for vi mode so they don't trigger the arg: N repetition.

Try inserting the following in your ~/.bashrc (or you can test it in an active terminal first):

bind -m vi 3:self-insert

Then try hitting Escape and typing 3. You should get the number 3 printed. However, this is probably not a good behaviour, since you probably don't want the number printed when you're not in insert mode. To disable the number keys completely when not in insert mode, just do the following for all numbers:

bind -m vi N:

(for N={0..9}).

In your ~/.bashrc, you can add:

for N in {0..9};
    bind -m vi $N:
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.