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 />
xp<br />
In reality, xp is really not fixing the typo.<br />
• x – deletes the current character (e), which also moves the cursor to<br />
next character (h)<br />
• p – Pastes the previously deleted character (e) after the current<br />
character (h).<br />
• The mnemonic for xp is "transpose".<br />
Hack 32. The power of the . (dot) Command<br />
The . (dot) command is simple and yet powerful. The . (dot) command<br />
repeats the last file-content-affecting command. The following example<br />
demonstrates the use of the . command.<br />
1. Search for a string in a file using: /john<br />
2. Replace john with jason using: cwjason<br />
3. Search for the next occurrence of john: n<br />
4. Replace john with jason using: . (dot)<br />
In the above example, at step#4, you don’t need to type cwjason again.<br />
Instead, simply type . (dot), which will execute the last change command,<br />
which is cwjason.<br />
59