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

For example, if you type `a , it will take you to the bookmark with name “a”.<br />

i.e It will take you to the place where the cursor is high-lighted in the above<br />

Fig.<br />

`a<br />

Method 2 to access the bookmark : ‘{mark-name}<br />

single-quote followed by the mark name. Move to the beginning of the<br />

bookmarked line.<br />

For example, if you type ‘a , it will take you to beginning of the line that has<br />

the bookmark with name “a”. It will take you to the beginning of the<br />

“CustomLog logs/access_log combined” line in the above Fig.<br />

‘a<br />

Hack 16. Create Global Bookmarks inside Vim File<br />

When you have multiple files open, if you want to go to a particular position<br />

in any one of the open files, then you can use Global mark feature of Vim. If<br />

the bookmark name is an upper case letter, then that is a Global Bookmark.<br />

The following sequence of steps will explain how to use a global bookmark<br />

while editing multiple files.<br />

1. Open multiple files: # <strong>vim</strong> /etc/passwd /etc/group<br />

2. While editing /etc/passwd file go to a specific line and type mP to<br />

create a global bookmark called P<br />

37

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

Saved successfully!

Ooh no, something went wrong!