14.06.2014 Views

vim 101 hacks

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Buyer: xiujuan lu (luxiujuan@gmail.com)<br />

Transaction ID: 85W16630AD8515549<br />

Vim <strong>101</strong> Hacks<br />

www.thegeekstuff.com<br />

Example 3. Substitution of a text with another text within a range<br />

of lines<br />

You can specify only a range of lines to be affected in the substitution.<br />

Specifying 1, 10 as the range limits substitution to only lines 1 – 10.<br />

:1,10s/I/We/g<br />

Example 4. Substitution of a text with another text by visual<br />

selection of lines<br />

You can control the substitution range by visually selecting specific lines.<br />

Press CTRL + V in command mode, use navigation keys to select the part of<br />

the file you want to be used as range. Press ‘:’ which will automatically<br />

change to :’<br />

Once it automatically changes to :’ , you can start typing the rest of the<br />

command as shown below.<br />

:'

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

Saved successfully!

Ooh no, something went wrong!