Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
2  
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

1 Answer 1

up vote 4 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   
$endif 

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

 
discard

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.