I work a lot in vim and the thing that frustrates me is when I have to switch to the shell, that I lose a lot of the keyboard control that vim has.

For example I have to use home and end to get to beginning and end of the line.

How do you deal with this annoyance?


According to the Bash manual, Bash natively supports a "vi-style command line editing interface". To use it, add set -o vi to your ~/.bashrc file.

By default you'll be in input mode; press Esc to enter command mode. This cheatsheet lists the commands available to you.

  • That's so awesome. – Pickels Jun 17 '11 at 14:29
  1. Use Home and End in Vim too.
  2. Learn all the shortcuts there are in the shell.

Usually, Ctrl-A and Ctrl-E go to the beginning and end of the line, respectively. You can define any number of shortcuts in your .inputrc file, and even switch to vi-mode. Try man bash and look for READLINE.

  • By default bash uses emacs text editing mode. You can set it to vi-mode as ændrük, if you're used to vi that's probably easier. – Niels Bom Jan 13 '12 at 11:38

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.