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

Note: You can map the :w command to the :up command using the Vim map<br />

feature explained in Hack 80.<br />

Hack 56. Edit Current Buffer Content<br />

You can change the content of the opened buffers using bufdo as shown<br />

below.<br />

Syntax:<br />

:bufdo! LINERANGE ! CMD<br />

For example, you can replace a pattern of text in the buffer as shown below.<br />

:bufdo! 1,$ ! sed "s/pattern/replace/"<br />

(or)<br />

:bufdo! 1,$s/pattern/replace/<br />

Hack 57. Tabs and Spaces<br />

The following are important tabs and space related commands.<br />

Command<br />

:set expandtab<br />

Description<br />

Convert tabs to spaces automatically.<br />

For example, When you type Tab, it will be<br />

converted it to 8 spaces.<br />

92

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

Saved successfully!

Ooh no, something went wrong!