5

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

This:

somecmd --itslong --reallylong
5
  • A down vote? Why? Apr 15, 2014 at 21:04
  • Maybe try and rephrase your question. You phrased it as a threat!
    – user3227965
    Apr 15, 2014 at 21:09
  • Why is it a threat? The tags? Apr 15, 2014 at 21:13
  • 1
    @user3227965 What threat? I don't see any threat here. Apr 15, 2014 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, 2014 at 16:22

2 Answers 2

1

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.

3
  • 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. Apr 16, 2014 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. Apr 16, 2014 at 4:07
  • 1
    Really? I said how do I make it not do that. Though that should have been show the args. Apr 16, 2014 at 6:10
1

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

Removing lines 109 and 241 will remove the message.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .