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

* Purpose :<br />

* Creation Date : 20-12-2008<br />

* Last Modified :<br />

* Created By :<br />

_._._._._._._._._._._._._._._._._._._._._.*/<br />

When you save the myfile.c file, it will automatically update the Last<br />

Modified field accordingly as shown below.<br />

$ vi myfile.c<br />

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.<br />

* File Name : myfile.c<br />

* Purpose :<br />

* Creation Date : 20-12-2008<br />

* Last Modified : Sat 20 Dec 2008 09:37:30 AM PST<br />

* Created By :<br />

_._._._._._._._._._._._._._._._._._._._._.*/<br />

Explanation of the autocmd commands inside ~/.<strong>vim</strong>rc<br />

$ cat -n ~/.<strong>vim</strong>rc<br />

1 autocmd bufnewfile *.c so<br />

/home/jsmith/c_header.txt<br />

2 autocmd bufnewfile *.c exe "1," . 10 . "g/File<br />

Name :.*/s//File Name : " .expand("%")<br />

3 autocmd bufnewfile *.c exe "1," . 10 .<br />

79

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

Saved successfully!

Ooh no, something went wrong!