Administration
  Home arrow Administration arrow Page 6 - Vi 201
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 Rational Software Development Conference
 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 201
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2000-05-11

    Table of Contents:
  • Vi 201
  • Liar, Liar...
  • Re-thinking Relativity
  • Sweet Revenge
  • The Shell Game
  • First Aid 101
  • An Indent In Time...
  • Exit Flootburger

  • 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
     
     
    The Best Selling PC Migration Utility.
     
    ADVERTISEMENT

    PCmover - $15 Off with Coupon Code CJPH7Q

    Vi 201 - First Aid 101
    (Page 6 of 8 )

    Unlike some of its better-known brethren, vi comes with some powerful crash recovery features. For example, let's suppose you're editing a file named "cart.php3", and your system suddenly crashes because Joe in the other room mistook the server's power button for the microwave's on/off switch.

    Hey, some people are just born stupid-after all, only a moron would keep the microwave next to the server!

    Well, once you get the system back up, recovering your file is as simple as typing

    vi -r cart.php3
    For every file that you edit, vi creates a temporary swap file by the same name and the file extension .swp in the same directory. When you add the -r parameter to the file name, vi will attempt to "recover" the file by reading the temporary backup and combining it with bits of the original file to get you back to where you were before the crash.

    The temporary swap file is usually updated every four seconds or every 200 characters - although you can change this with the "updatetime" and "updatecount" commands.

    Once you've confirmed that the restored version of the file is acceptable, you should delete the swap file to avoid error messages.

    In addition to swap files, another very important file is the vi configuration file, usually found lurking in your home directory under the name ~/.vimrc . This configuration file is read every time you start the editor, and the commands and options in it executed automatically.

    All the "colon" commands you've learnt thus far can be placed in the configuration file for automatic execution. There's one simple rule of thumb - if you execute the command while the editor is running, you usually need to precede it with a colon [as in the examples above]; however, the same command, when placed in the configuration file, will *not* be preceded by a colon. So, for example, though I might type

    :abbreviate god Professor Elias Flootburger The Third
    in the editor, my configuration file would only contain

    abbreviate god Professor Elias Flootburger The Third
    without the initial colon [:]

    A simple way to create your .vimrc configuration file is to set the editor up the way you want, and then execute the command

    :mkvimrc
    which will create a configuration file for you automatically. And also take a look at Sven Guckes' heavily commented configuration file at http://www.math.fu-berlin.de/~guckes/vim/vimrc.forall for more information on the various options.

    This article copyright Melonfire 2000. All rights reserved.

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


     

       

    ADMINISTRATION ARTICLES

    - 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 ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD

     
    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 6 hosted by Hostway