Administration
  Home arrow Administration arrow Page 5 - Vi 101
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ADMINISTRATION

Vi 101
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2000-03-27


    Table of Contents:
  • Vi 101
  • Vi? V who?
  • Start Me Up!
  • Let's Tango!
  • Lather, Rinse, Repeat...
  • One, Two, Buckle My Shoe...
  • Searching For Hope
  • Of Files And Windows
  • Saved By The Bell

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Vi 101 - Lather, Rinse, Repeat...
    ( Page 5 of 9 )


    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 Administration Articles          >>> More By Vikram Vaswani, (c) Melonfire
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek