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 46. Jump to Variable Declaration<br />

Go to the local declaration of a variable.<br />

gd<br />

Go to the global declaration of a variable.<br />

gD<br />

Hack 47. Align the Variable Assignment<br />

The following is an example code, where variables are not aligned properly.<br />

$a = 1;<br />

$a_very_long_variable_name_value = 1;<br />

$b = 1;<br />

$my_short_variable_value = 1;<br />

Install the Align.<strong>vim</strong> plugin.<br />

$ <strong>vim</strong> Align.vba.gz<br />

:so %<br />

:q<br />

Visually select the text need to be aligned, and do the following.<br />

:'

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

Saved successfully!

Ooh no, something went wrong!