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

Chapter 9: Vim Command Line Hacks<br />

You can view all of the available command line options for Vim as shown<br />

below.<br />

$ <strong>vim</strong> –h<br />

Hack 58. Open File in Read Only Mode<br />

Open files in read only mode as shown below using the –R option.<br />

# <strong>vim</strong> -R filename.txt<br />

(or)<br />

# view filename.txt<br />

Get into the habit of using one of the above methods when you don’t intent<br />

to edit a file. This will help you to avoid making any unintentional<br />

modifications to the file.<br />

Hack 59. Recover Swap File Explicitly<br />

Use option –r as shown below to list swap files from current directory, ~/tmp,<br />

/var/tmp, /tmp.<br />

The following command shows all the swap files.<br />

94

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

Saved successfully!

Ooh no, something went wrong!