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

Chapter 1: Vim Basics<br />

Before we begin to review the <strong>101</strong> <strong>hacks</strong>, let us understand a few basics of<br />

the Vim editor.<br />

Opening a File<br />

There are two methods to open a file. The following examples will open the<br />

/etc/passwd file.<br />

Method 1: Open from command line as explained above.<br />

$ <strong>vim</strong> /etc/passwd<br />

Method 2: Open from the Vim editor after launching it.<br />

$ <strong>vim</strong><br />

:e /etc/passwd<br />

Saving a File<br />

The following are methods to save a file.<br />

Save Methods<br />

Description<br />

:w (or) :write Save working file<br />

:up (or) :update<br />

Save working file<br />

13

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

Saved successfully!

Ooh no, something went wrong!