Qondio
Front
Intel
IntelMart
Shares
My Qondio
Account
Roy Law > Intel > Software > Introduction to vi - Part 1 of 2

qondio.com/b3fY PRINT EMAIL

Introduction to vi - Part 1 of 2

All computers need operating systems, all operating systems use scripts (user-written sets of instructions), all scripts need editors. vi is the default editor for UNIX (one of the greatest operating systems of all time).

The name derives from visual editor, which is not such as contradiction as it seems since early computer editors worked on a single line or worse.

Single-handledly it has been regarded as responsible for the majority of nervous breakdowns amongst those learning UNIX

because

[1] in vi it is vital to remember that the keyboard can be in one of two modes, yet there is no visual indication of this!
[2] in vi most of the special keys (including arrows) won't work!
[3] in vi there is no visual indication of which file you are editing! However, you do have a new best friend and the cursor movements rapidly become natural without adversely affecting any other aspect of your life.


1. BASICS

• YOUR BEST FRIEND

is the escape key ESC.

• HOW TO GET OUT WITHOUT SAVING
Press ESC twice then type q! and press ENTER.

• HOW TO GET OUT WITH SAVING
Press ESC twice then type wq and press ENTER.

• HOW TO GET IN
vi filename

• HOW TO START A NEW FILE
vi newfilename which will start in command mode showing a what looks like a sea of blank lines.

• HOW TO INPUT
i to input at the cursor

• HOW TO DELETE
x to delete character at the cursor

• KEYBOARD MODES
Either command or input; ESC always returns you to command mode but it is not a toggle.


2. KEYBOARD KEYS



• + in command mode
Moves to next line.

• ENTER in command mode
Moves to next line.

• ENTER in input mode
Creates new line.

• SPACE in command mode
Moves to next character.

• BS (BackSPACEE) in command mode
Moves to previous character.

• CTRL--B in command mode
Moves Back one page.

• CTRL—-F in command mode
Moves Forward one page.

• G in command mode
Moves to last line of file.

• u in command mode
Undo previous command.

• . in command mode
Repeat previous command.



3. PRACTICE

• THE BEST PRACTICE ... IS FOR REAL.

• HOWEVER, get a copy of the daphne file (see Appendix) into your home directory and use that for practice.

• EXTEND YOUR KNOWLEDGE from the GLOSSARY in Part 2.

• ALWAYS check which directory you are in.

APPENDIX - the daphne file

This should be a small, plain, vanilla-flavoured, text (ASCII) file; it is believed to have been named after the very first air hostess (Daphne Vickers) - I first encountered it through the guy who taught me vi (Andrew Whitechapel).

Hello
I am the daphne file
I am very small and insignificant
I am even smaller than an asterisk *
I'd like to be bigger
I'm sleepy now
Goodnight little daphne
Goodnight all!

(C) 1992/1999, Roy Law.

Images


Contributed by Roy Law on April 1, 2008, at 8:05 AM UTC.

PLEASE VISIT THE CONTRIBUTOR'S WEBSITE
Systems Studio solves accounts and data problems
Your data chaos sorted!
www.SystemsStudio.com

Reactions

No reactions yet.

Rate This Intel

Please login or sign up to rate this intel.

Comments

Please login or sign up to add a comment.

Share

Copyright Notice

The copyright for this content entitled "Introduction to vi - Part 1 of 2" has been specified by the contributor as:

All Rights Reserved

This content may not be copied, distributed or adapted by anyone under any circumstances.

Login Here with
Any Email Address
Any Password
No account? Sign up.

Intel Contributor
This intel was contributed by Roy Law


Roy Law

Qondio Archive
May, 2012
123456
78910111213
14151617181920
21222324252627
28293031


2008
January, February, March, April, May, June, July, August, September, October, November, December
2009
January, February, March, April, May, June, July, August, September, October, November, December
2010
January, February, March, April, May, June, July, August, September, October, November, December
2011
January, February, March, April, May, June, July, August, September, October, November, December
2012
January, February, March, April, May

Sign Up
Not a member yet? Qondio is a powerful network for making it online. If you have a website to promote, we can help. Sign up and get in on the action.

About Qondio
Welcome to Qondio! Discover the awesome power this network can deliver by going to our About page. Or you could skip straight to the Sign Up form.

ABOUT
SUCCESS GUIDE
FEATURES
FAQ
ADVERTISE
CONTACT
USAGE POLICY
PRIVACY POLICY


TWITTER
FACEBOOK