Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
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.

share|improve this answer
    
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

 
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.