![]() |
||||||||||||
|
|
Using the VI editorOverviewVI is a UNIX editor that allows you to create and modify programs or bodies of text.Creating Or Editing A File With VITo create or edit a file with vi, type:If the file does not already exist, it will be created. Changing Between Command And Insert ModesThere are two modes in vi: command mode and insert mode. When vi starts up in command mode. As such, any key pressed will be interpretted by vi as a command, rather than text.Before you can enter text, you must change to insert mode. Do this by typing: afor append or: ifor insert. Insert mode works just like
a typewriter. Anything you type will be inserted into your document. When
you are done typing and ready to get back into command mode, press Moving The Cursor In VIThese commands allow for navigation while in command mode:COMMAND: ACTION: h move left one character j move down one line k move up one line l move right one line Inserting TextThese commands change to insert mode: (Hita append text after the cursor i insert text under the cursor o insert a new line beneath the cursor O insert a new line above the cursor Deleting TextThese commands delete text while staying in command mode:x delete the character under the cursor dw delete from cursor to end of word dd delete the line the cursor is on Saving And QuittingThese commands save and/or quit from vi: (Must be in command mode):w For More InformationContact the Information Center at 646-1840 |
|
|
Questions? Comments? Send us e-mail.
Last Modified: Sunday, January 13, 2008 Copyright 2006, Regents of New Mexico State University |
||