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

Step 3: Copy that macro in to the register.<br />

"ayy<br />

Bonus Hack 6. Indent Code Block<br />

Before Indent<br />

int main()<br />

{<br />

printf("Hello World!\n");<br />

After Indent<br />

int main()<br />

{<br />

printf("Hello World!\n");<br />

printf(“Done.”);<br />

}<br />

}<br />

printf(“Done.”);<br />

There are two methods to indent the code as show above.<br />

Method 1:<br />

• Move the cursor to either the { or }<br />

• Press >i{ to indent the code located in between { and }<br />

Method 2:<br />

• Move the cursor to the 1 st line after { . i.e printf<br />

• Enable visual mode by pressing v key<br />

• Use arrow key to select the lines in between { and }<br />

159

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

Saved successfully!

Ooh no, something went wrong!