14.06.2014 Views

vim 101 hacks

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Buyer: xiujuan lu (luxiujuan@gmail.com)<br />

Transaction ID: 85W16630AD8515549<br />

Vim <strong>101</strong> Hacks<br />

www.thegeekstuff.com<br />

Hack 81. Make Bash Shell work like Vim Editor<br />

Once you’ve become familiar with Vim shortcuts, you may want to use the<br />

same from your Unix command prompt.<br />

By default the bash command line editing is done with emacs keystrokes.<br />

To use Vim keystrokes for command line editing, set the following.<br />

$ set -o vi<br />

After you perform set -o vi , bash will act virtually like it is in insert mode.<br />

Press ESC to go to command mode. From here you can execute most Vi<br />

commands to perform command line editing.<br />

Make this change permanent by setting this option in your .bashrc.<br />

$ cat ~/.bashrc<br />

set -o vi<br />

Execute the following to disable Vim mode and go back to emacs mode.<br />

$ set -o emacs<br />

121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!