BrainDump
  Home arrow BrainDump arrow Page 3 - A Look at the VI Editor
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 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? 
BRAINDUMP

A Look at the VI Editor
By: Mamun Zaman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2007-08-07

    Table of Contents:
  • A Look at the VI Editor
  • Saving and Closing a file
  • Cursor motion/movements
  • Undo editing

  • 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
     
     
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    A Look at the VI Editor - Cursor motion/movements
    (Page 3 of 4 )

    To move your cursors in VI use the following commands (a long list!).

    h

    Move left

    j

    Move down

    k

    Move up

    l

    Move right

    w

    Move to next word

    W

    Move to next blank delimited word

    b

    Move to the beginning of the word

    B

    Move to the beginning of blank delimited word

    ^

    Moves to the first non-blank character in the current line

    +

    Moves to the first character in the next line

    -

    Moves to the first non-blank character in the previous line

    e

    Move to the end of the word

    E

    Move to the end of blank delimited word

    (

    Move a sentence back

    )

    Move a sentence forward

    {

    Move a paragraph back

    }

    Move a paragraph forward

    0 or |

    Move to the beginning of the line

    $

    Move to the end of the line

    :n

    Move to nth line of the file

    For jumping to the beginning of the document use [[, and use ]] to jump to the end of the document.

    Deleting texts: To delete content use d and x. Use x for deleting character to the right of the cursor. Use d with the above operands (motion/movement operands) for deleting. To delete a word use dw (next word). Delete is basically cut, i.e. you can paste the deleted contents. The following are some other delete commands.

    x

    Delete character to the right of cursor

    nx

    Deletes n characters starting with the current one; omitting n deletes current character only

    X

    Deletes the character to the left of cursor

    nX

    Deletes the previous n characters; omitting n deletes the previous character only

    D

    Delete to the end of the line

    D$

    Deletes from the cursor to the end of the line

    dd or :d

    Deletes the current line

    ndw

    Deletes the next n words starting with the current word

    ndb

    Deletes the previous n words starting with the current word

    ndd

    Deletes n lines beginning with the current line

    :n,md

    Deletes lines n through m

    Tips: You can edit multiple lines better if you know the line numbers. To show line numbers use the following command.

    :set nu

    For example, to go to line number 5 use :5

    More BrainDump Articles
    More By Mamun Zaman


       · As someone who has been using vi for over 20 years, the part about "Unix" using the...
       · After you have done a search (using / or ?) you can repeat the search using either n...
     

       

    BRAINDUMP ARTICLES

    - Outsourcing: the Hoopla, the Reality
    - MySQL Plays in the Sun
    - All About SQL Functions
    - SQL: Functioning in the Real World
    - More Advanced SQL Statements
    - Beginning SQL the SEQUEL: Working with Advan...
    - Beginning SQL
    - A Look at the VI Editor
    - A Quick Tour of Boo
    - Book Review: Open Source Licensing
    - PGP and GPG: Email for the Practical Parano...
    - Microsoft Continues War on Open Source
    - Secure Remote Desktop Sharing with VNC on Li...
    - A Look at Google Project Hosting
    - What we can Learn from Two Linux vs. Microso...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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