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  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
Moblin 
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? 
ADMINISTRATION

Vi 101
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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
     
    IBM developerWorks
     
    ADVERTISEMENT

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    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

    - 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
    - Advanced Concepts on Dealing with Files and ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway