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

In this example, there are three swap files associated with the previous edits<br />

on file1.c, file2.txt and change-password.sql in the current directory.<br />

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

Swap files found:<br />

In current directory:<br />

1. .file1.c.swp<br />

owned by: ramesh dated: Sat Apr 25 06:58:49 2009<br />

file name: ~ramesh/file1.c<br />

modified: YES<br />

user name: ramesh host name: ramesh-laptop<br />

process ID: 14374<br />

2. .file2.txt.swp<br />

owned by: ramesh dated: Sat Apr 25 07:28:49 2009<br />

file name: ~ramesh/file2.txt<br />

modified: YES<br />

user name: ramesh host name: ramesh-laptop<br />

process ID: 14145<br />

3. .change-password.sql.swp<br />

owned by: ramesh dated: Sun Jan 11 13:11:51 2009<br />

file name: ~ramesh/change-password.sql<br />

modified: YES<br />

user name: ramesh host name: ramesh-laptop<br />

process ID: 24686<br />

In directory ~/tmp:<br />

-- none --<br />

In directory /var/tmp:<br />

-- none --<br />

In directory /tmp:<br />

-- none --<br />

When a swap file exists and if you try to open the original file, you’ll get the<br />

following message.<br />

# <strong>vim</strong> file1.c<br />

95

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

Saved successfully!

Ooh no, something went wrong!