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

• Now you can simply press the function key, which will undo your<br />

previous insert and use it as normal mode commands which in this<br />

case change the word john to Jason.<br />

To achieve this, you should add the following line to your .<strong>vim</strong>rc<br />

$ cat ~/.<strong>vim</strong>rc<br />

inoremap u@.<br />

Note: There is a . (dot) next to ‘@’ at the end of the above line<br />

Hack 37. Abbreviation and Unabbreviation<br />

In the following example, whenever you type US it will expand to “United<br />

States” when you’ve defined the following abbreviation.<br />

To abbreviate a word temporarily, execute the abbr command in command<br />

mode as shown below.<br />

:abbr US United States<br />

To abbreviate a word permanently, you can place it in the .<strong>vim</strong>rc as shown<br />

above.<br />

To remove an abbreviation definition temporarily, execute the noabbr<br />

command in command mode.<br />

:noabbr US<br />

66

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

Saved successfully!

Ooh no, something went wrong!