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

Visual Mode<br />

Commands<br />

<br />

Description<br />

Exit visual mode<br />

d<br />

Delete only the highlighted text.<br />

For example, if only part of the line is selected, it<br />

deletes only the selected text from that line.<br />

D<br />

Delete rows under highlighted text.<br />

For example, if only part of the line is selected, it<br />

deletes the entire line.<br />

y<br />

Copy (yank) only the highlighted text<br />

Y<br />

Copy (yank) rows under highlighted text<br />

c<br />

Delete highlighted text and go to insert mode<br />

C<br />

Delete rows under highlighted text and go to insert<br />

mode<br />

Hack 34. Editing with :g<br />

The following are some awesome examples to show the power of :g<br />

Example<br />

:g/^$/d<br />

Description<br />

Delete all empty lines in the file<br />

62

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

Saved successfully!

Ooh no, something went wrong!