Find the answer to your Linux question:
Results 1 to 4 of 4
Hey, all i really need is a place to post this that i know google will cache. I've seen one other person on the Internet who had the exact same ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    235

    [Solved] howto remap bash keys in vi mode


    Hey, all i really need is a place to post this that i know google will cache. I've seen one other person on the Internet who had the exact same problem as I, we both use dvorak keyboards and wanted to use bash vi mode, but couldnt rebind our keys. To work this out i actually had to go through the source code of libreadline, so i want to save anyone else the pain.

    To rebind the vi command mode keys, you have to first set the keyboard layout to vi-move (or vi, or vi-command) and then make your bindings. This may seem logical, but the documentation doesnt even hint that this may be a solution. My .inputrc file has the following

    Code:
    $if mode=vi
    
    set keymap vi-move
    
    "h": backward-char
    "t": prev-history
    "n": next-history
    "s": forward-char
    "k": vi-search-again
    
    $endif
    and also because i know that this will probably relate to only very few people, hello to the guy using a dvorak keyboard and wanting to use vi mode 4 years from now

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    699
    excelent, I've been wondering about this. I've gotten so accustomed to the VI mode of doing stuff, it has been the one thing holding me back from using dvorak. Do you know how to rebind keys in vim text editor??
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  3. #3
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    235
    lol now thats easy

    at this to your .vimrc. Actually i just remembered that i shifted all my movement keys one key to the right, so you may still need to adjust this.

    Code:
    noremap t j
    noremap j t
    noremap n k
    noremap s l
    noremap k n
    
    noremap <s-t> 12j
    noremap <s-n> 12k

  4. #4
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    699
    thanks, I've been wondering. Now I can maybe give dvorak a serious attempt.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •