I am using vi mode in a bash shell.

If I enter insert command mode and type a number from 1-9 (eg: 5, in the example below), I get the following prompt:

(arg: 5) <cursor>

What does this mean? I can't seem to do anything useful with this prompt, and I don't know what its purpose is.

I even poked into the bash sources, which in turn gets into the GNU Readline sources.

The function that ends up being called is rl_vi_arg_digit, which then calls rl_digit_argument, which displays the (arg: N) prompt. But I can't see from comments or related code what it's actually used for.

Anyone know?


You actually exited insert mode and are in command mode. The number is an argument that can be used with motion keys, just as in vi: e.g. 5h moves left 5 characters. Likewise you can say 5s to delete the next 5 characters and go into insert mode (substitute for 5 characters).

  • whoops, you're right about command mode - i'll fix the question – jwd May 11 '11 at 19:12

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.