Home arrow Site Administration arrow Page 5 - Vi 101

Lather, Rinse, Repeat... - Administration

Vi is probably the most powerful text editor for *NIX, but if you have ever tried to use it, you probably walked away frustrated. This article walks through all the capabilities and features of Vi - from the basics, such as saving and quitting, to the more advanced topics of searching for strings.

TABLE OF CONTENTS:
  1. Vi 101
  2. Vi? V who?
  3. Start Me Up!
  4. Let's Tango!
  5. Lather, Rinse, Repeat...
  6. One, Two, Buckle My Shoe...
  7. Searching For Hope
  8. Of Files And Windows
  9. Saved By The Bell
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 5
March 27, 2000

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Next up, deleting and copying text. To delete a single character, position the cursor under it, make sure you're in command mode, and type

x
to delete it. To delete a word, hit

dw
which stands for "delete word". Nuking an entire line is accomplished with

dd
while novelists with writers block will appreciate the thoughtfulness of the

dgg
and

dG
commands, which delete everything from the current cursor position to the beginning and end of the file respectively.

Oops - you didn't just try that last one, did you? Not to worry - vi also comes with a very handy "undo" command, which can be accessed by hitting

u
whenever you feel the urge to undo your previous mistakes. And since undo and redo go together like strawberries and cream, you might want to check out the "redo" command, which allows you to repeat past actions by typing

. [yup, that's a period]
When you delete something in vi, the deleted text usually finds its way to a temporary buffer in memory, where it resides until it is replaced. This deleted text can be re-inserted into your document with the "put" command; if you've been following along, you already know that the "put" command is accessed with

p
Go on - try it. Delete a line, move down to a new paragraph, and put it back in a different place. Simple - and equivalent to the cut-paste functionality available in other editors.

In case you'd like to insert the deleted text *above* the current cursor position, simply use

P
instead of

p
What about copy-paste? Also pretty easy - vi uses the "yank" command to copy text in much the same way as the delete command is used to delete text. To yank a particular word, try

yw
while

yy
yanks a complete line and places it in the temporary buffer, ready to be "put" somewhere new.

You're probably wondering what all this has to do with shampoo. Absolutely nothing - this particular lesson was originally titled "Cut, Copy, Paste...", but I thought "Lather, Rinse, Repeat..." had a nicer ring to it...

This article copyright Melonfire 2000. All rights reserved.

 
 
>>> More Site Administration Articles          >>> More By Vikram Vaswani, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: