Talk Root - PC Hardware, Software and Web Development forums

Go Back   Talk Root - PC Hardware, Software and Web Development forums > Operating Systems > Linux Discussion

Linux Discussion Talk about linux issues with networking, programming, general using and development


Welcome to the Talk Root - PC Hardware, Software and Web Development forums. Are you a programmer, web developer, IT guy or a computer guru? We invite you to join our forums and participate in friendly discussion. It doesn't matter your skill level, we are here to help everyone.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Sponsored Links
Reply
 
LinkBack Thread Tools Rate Thread
Old 10-24-2003, 01:05 PM   #1
Interactive
Senior Member
 
Join Date: Oct 2003
Location: Sierra Vista, AZ, USA
Posts: 264
Send a message via AIM to Interactive
Introduction Into VI (visual editor)

Well when I first started playing with Linux (redhat) I would only use Pico as a text editor. Now pico's great and all, but I had heard VI was a lot more advanced. Not only a lot more advanced, but a lot more confusing. So I did some research and started messing with it.

The biggest thing to comprehend, in my opinion, when it comes to VI is the 3 different modes. These of which are Master, Command, and Text. Now my largest complaint about VI is the fact that it actually doesn't tell you anywhere on the screen what mode you are in. However, when you first start VI you will be in master mode. You can always get to master mode by hitting [ESC] if it says "Insert" or if there's a colon (both would be at the bottom of the screen) then hit [ENTER]. You can only switch from Master mode to Command mode, and Master mode to Text mode (insert) or vice versa.

So we'll start by creating a new file called "test_doc". Login to your Linux box, or if you're in front of it and in a GUI, open up the BASH Shell. Type the following command:
Code:
vi test_doc
This will open up vi (the file won't actually be saved until you tell it to). Now you'll notice that if you type any text, nothing will happen (unless you press [i]). This is because you're in Master mode as explain previously. So go ahead and press [i]. There should now be "insert" at the base of the screen, as you are now in text mode. Type a few lines of text and then hit [ESC]. By hitting [ESC] in Text mode (remember "insert"?) it will bring you back to Master mode. Now to save the file goto Command mode by typing colon ([:]), remember you can only goto Command mode from Master mode and not from Text mode. There should now be a colon displayed at the bottom of the screen. Go ahead and type w and hit enter. This will write the file to disk. Now it will bring you back into Master mode. If you want to leave VI enter Command mode (remember, colon) and type [Q] and then hit enter. You can also run both the write command and the quit command at the same time by just typing wq.

I hope this tutorial helped you understand the very useful, but at first confusing, VI tool.

This tutorial will be in a series of basic Linux tutorials that I'm working on and will try to maintain and keep up to date, as far as grammar goes and the technical aspects. Feel free to ask any question in this thread.

History of VI:
VI was developed around the same time that UNIX was (well duh, as it is a UNIX based program ;)) (1974). It's basically just like any other text editor such as notepad, but you can do a lot more with it. The draw back with it is that you have to use commands to perform any action (such as writing the file to disk).
__________________
-Rob
Interactive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 12-20-2003, 11:42 AM   #2
Steve
Administrator
 
Join Date: Dec 2003
Posts: 134
Interactive great idea! Lots of people seem to have trouble using VI. Any plans to continue this tutorial?
Steve is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-15-2004, 02:33 PM   #3
Interactive
Senior Member
 
Join Date: Oct 2003
Location: Sierra Vista, AZ, USA
Posts: 264
Send a message via AIM to Interactive
Quote:
Originally posted by Greg Bernhardt

Interactive great idea! Lots of people seem to have trouble using VI. Any plans to continue this tutorial?
Actually have a few more in the works that I'll post once I finish my technical writing class.
__________________
-Rob
Interactive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-08-2007, 06:06 PM   #4
happy2bg33k
Registered User
 
Join Date: Mar 2007
Posts: 33
Nice tutorial. I am a longtime VIM user. VI (and VIM) is a very featureful editor, more than most people make use of. I always preferred it to Emacs, as I was tired of practicing finger-fu if I wanted to make use of a lot of features in that editor.
happy2bg33k is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 07:24 PM.


Sponsors
Banner Best Deals 24x7 @ Geeks.com!
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0 RC8
vB Ad Management by =RedTyger=
© 2006 TalkRoot.com -