Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Dvorak and vi, so when I found out about the vi mode in Bash, I was very excited. However, it would be even better if I could remap the movement keys to be the ones that I use in vi (I swap keys around until the movement keys are back on the home row in Dvorak).

How can I do this?

share|improve this question
Take a look at the bind built-in command in bash, or if you want the changes to be uniform across all readline apps, modify ~/.inputrc. – jw013 Dec 26 '11 at 20:42
up vote 6 down vote accepted

You can create a file named '.inputrc' in your home directory.

# want vi to be the default editor for readline                      
set editing-mode vi                                            

# vi settings                                         
$if mode=vi                
    # normal mode                           
    set keymap vi-command                                 
    "j": beginning-of-history
    "l": backward-char
    "h": forward-char         
    "G": end-of-history
    # insert mode             
    set keymap vi-insert                          
    "jj": vi-movement-mode # remap escape   

These are my mappings, with the exception of l and h. I switched those here, to show you how you can switch keys. I don't know the Dvorak keys you want, just modify all those keys like you want.

man bash describes all the possiblities.

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.