Home arrow Site Administration arrow Page 3 - Vi 201

Re-thinking Relativity - Administration

In his last class, he taught you the basics of vi, the powerful *NIX text editor. Now Elias Flootburger returns in this hilarious sequel to theoriginal "Vi 101" tutorial. This time, the good professor has his handsfull with abbreviations, key mappings, autocommands and vi's powerfulvisual mode...not to mention his own out-of-control ego!Note: Most of the material in this article covers vim, the enhanced version of vi that is preinstalled on most modern *NIXes.

TABLE OF CONTENTS:
  1. Vi 201
  2. Liar, Liar...
  3. Re-thinking Relativity
  4. Sweet Revenge
  5. The Shell Game
  6. First Aid 101
  7. An Indent In Time...
  8. Exit Flootburger
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 4
May 11, 2000

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
According to Einstein, time is relative. According to Flootburger, time is money - especially when you're billing by the hour. And so, for all you smarmy consultants-to-be, here are some tips and tricks that should help you in bleeding the last cent from your eight-hour day.

First on the list: abbreviations. Vi allows you to define abbreviations for commonly-used words or phrases, and insert the complete word or phrase simply by typing its abbreviation. All this happens via the "abbreviate" command, which looks like this:

:abbreviate <abbreviation> <replacement-text>
or, for convenience,

:ab <abbreviation> <replacement-text>
From my own experience, I can tell you that this command is a boon to all those of us blessed with a somewhat longer-than-usual name. In my case, for example, I often use this abbreviation:

:abbreviate god Professor Elias Flootburger The Third
Go on - try it out yourself. Each time you type the word "god" in your document and follow it with either a space or a carriage return, vi will automatically replace it with the complete, unabridged version.

And once you get tired of seeing my name all over your document - how could you?! - you can remove the abbreviation with the

:unabbreviate god
or

:unab god
command.

To remove *all* abbreviations from memory, the command to use is

:abclear
Abbreviations are particularly useful for inserting frequently-used snippets of text - email addresses, telephone numbers and the like - into your documents. As a standard rule of thumb, if you find yourself typing the same piece of text more than five times in the same document, make it an abbreviation and use the money you save on RSI treatments to buy yourself a lifetime's worth of chocolate icecream - or simply donate it to the Flootburger Foundation For The Empowerment Of Semi-Retired University Professors. All donations are tax-deductible.

Vi also lets you enter symbols and accented characters, which cannot normally be entered with a regular keyboard. A digraphs table contains a list of different symbols, together with the key codes necessary to enter them; all you need to do is locate your symbol in the table, find the two characters that are mapped to create it, and enter them by typing

^-K <first-character> <second-character> [that's Ctrl-K]
For example, let's suppose you need to enter the copyright symbol

The first thing you need to do is look up the digraphs table to find out which combination of characters represents this symbol. You can access the digraphs table with the

:digraphs
command.

As you'll see, the digraphs table consists of a series of columns - the first two columns contain the characters which, when combined, create the symbol in the third column. The fourth column contains the decimal representation of the symbol. Our copyright symbol, for example, is represented by the characters "A" and "~", and the decimal code 169.

Now, in order to enter this symbol into your document, move to the appropriate location and enter insert mode by typing

i
Next, type

^-K <first-character> <second-character> [that's Ctrl-K]
In this case,

^-K A ~ [that's Ctrl-K, followed by A ~]
and your symbol will be entered into the document. Alternatively, if you'd prefer to use the decimal code, try

^-V <decimal code> [that's Ctrl-V]
In this case,

^-V 169 [that's Ctrl-V, followed by 169]


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: