Home arrow Site Administration arrow Page 8 - Vi 101

Of Files And Windows - Administration

Vi is probably the most powerful text editor for *NIX, but if you have ever tried to use it, you probably walked away frustrated. This article walks through all the capabilities and features of Vi - from the basics, such as saving and quitting, to the more advanced topics of searching for strings.

TABLE OF CONTENTS:
  1. Vi 101
  2. Vi? V who?
  3. Start Me Up!
  4. Let's Tango!
  5. Lather, Rinse, Repeat...
  6. One, Two, Buckle My Shoe...
  7. Searching For Hope
  8. Of Files And Windows
  9. Saved By The Bell
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 5
March 27, 2000

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

You've already seen that

$ vi <filename>
starts vi with the file specified already loaded. But why restrict yourself to one - you can load multiple files in this manner:

$ vi file1 file2 file3
To switch between files, use these commands:

:next = go to the next file in the file list
:rewind = go to the first file in the file list
:last = go to the last file in the file list

To exit all files at once, use

:qa!
to exit without saving, or

:wqa
to save all changes and exit [the "a" here means "all"]

Once you've started vi, you can also load a new file into the editor with the "edit" command, like this

:e /path/to/file.txt
If you'd prefer to insert the contents of another file directly into the document you're currently editing, there's a "read" command designed to do just that. Try it!

:read /path/to/file_to_be_inserted.txt
If you're a programmer, you'll definitely appreciate vi's ability to provide you with multiple views of the same file, referred to in geek speak as "window splitting". And the command is, naturally,

:split
Each of the windows created can be manipulated independent of the others, although changes made to the file will be immediately visible in all of them.

Let's take it one step further - how about having *different* files loaded into each of the windows? For example, wouldn't it be nice if you could load an HTML form into one, the associated CGI script into another, some help documentation into the third, and have all three visible at the same time?

Well, you can - simply use the "new" command to create a new window for each file, like this:

:new form.html :new mailform.cgi :new help.txt
To switch between windows, use

^W W [that's Ctrl-W, immediately followed by W]


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: