Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am a long time vi(m) user and recently made the switch to using vi key binding in bash. I can already tell that this will be an improvement, but I would like to customize a few things to really become proficient.

  1. I currently use the following mapping and it is totally entrenched: map ii <esc>. Can I do the same on the command line? It may seem trivial, but I am so used to just tapping i twice that reaching all the way up to the escape key is painful.
  2. I would LOVE to find a way to indicate what mode I am in: insert or command. This could take the from of changing the cursor type/color, putting a note in the prompt, etc.

I have looked through the man pages for bash and looked at creating an .inputrc file, but so far have come up with nothing that would work. I see that you can map keys, but can you do it for two keys hit in rapid succession, like I do?

I have seen solutions out there that say they work for zsh. I am not interested in switching to zsh. If this is not possible in bash, I can live with it.

share|improve this question

migrated from Aug 19 '12 at 22:08

This question came from our site for professional and enthusiast programmers.

First question addressed here, second addressed here, but it's a zsh answer. I know that zsh/bash prompt handling is different. – pb2q Aug 19 '12 at 18:27
Also see this question – pb2q Aug 19 '12 at 19:25
Cool... Thanks, pb2q, that first link is exactly what I needed. Unfortunately, for now, it seems my second request above is just not possible yet. – JmZ Aug 19 '12 at 21:56

1 Answer 1

Your first request is possible by the SO answer linked in pb2q's comment on your post.

Your second request is now possible if you have bash 4.3 and readline 6.3. Simply add this to your .inputrc:

set show-mode-in-prompt on

For me, it prepends a "+" to my prompt in insert mode, which changes to a ":" in command mode.

Source: this answer by eMPee584 on StackOverflow.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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