1 / 19

Visual Interface

Visual Interface. VI Text Editor and Commands Lesson 3. Visual Interface. VI Text Editor. There are various text editors for UNIX. But, this lesson focuses on VI Text Editor. VI Text Editor uses the entire screen and is a powerful editor. VI Text Editor is always a part of UNIX.

Télécharger la présentation

Visual Interface

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Interface VI Text Editor and Commands Lesson 3

  2. Visual Interface VI Text Editor There are various text editors for UNIX. But, this lesson focuses on VI Text Editor. VI Text Editor uses the entire screen and is a powerful editor. VI Text Editor is always a part of UNIX.

  3. Visual Interface VI Text Editor • There are two aspects of the VI Text Editor. • VI is a modal editor (a mode is like an environment). Different modes in VI interpret the same key differently. The two modes are Insert Mode and Command Mode. • VI is a screen-oriented program. It must know the terminal type of the system. Most systems are set at a default terminal type. If VI does not know the terminal type, please contact the Spillman Customer Support Department.

  4. Visual Interface VI Commands There are many vi commands (almost every letter is a command). Make sure that you are in command mode. In this lesson, we will present some basic vi commands. Please be aware that there are many other commands. CAUTION: Remember that vi commands are case sensitive. Use either upper or lower case letters as they are listed.

  5. Visual Interface Starting VI • To start VI, type vi filename. • If the filename already exists, VI opens the file to be edited. • If the filename does not already exist, VI creates a new file.

  6. Visual Interface VI Modes: Command Mode VI is either in command mode or input mode. When you first enter VI, you are in command mode. In command mode, letters or symbols that you type are interpreted as commands. To enter command mode, press the ESC key. You can press the ESC key multiple times to ensure that you are in command mode.

  7. Visual Interface VI Modes: Insert Mode In insert mode, the letters or symbols that you type are entered into the file you are editing. Use the following letters to enter insert mode: i Inserts text immediately before the cursor. I Inserts text at the beginning of the current line. a Adds text immediately after the cursor. A Adds text at the end of the current line. o Creates a new line after the current line. O Creates a new line before the current line.

  8. Visual Interface VI Commands: Saving and Exiting :Moves the cursor to the bottom of the screen, waiting for a command. :qIf no changes have been made, exits VI Text Editor without saving. :q!Exits VI Text Editor without saving changes. :wSaves changes to the file. :wqSaves changes and exits VI Text Editor. ZZ Saves changes and exits VI Text Editor.

  9. Visual Interface VI Commands: Navigation Tools $Moves the cursor to the end of the line. 0 (zero) Moves the cursor to the beginning of the line. CTRL+gMoves the cursor to the end of the page. hMoves the cursor left one character. jMoves the cursor down one line. kMoves the cursor up one line. lMoves the cursor right one character. /textSearches forward through the file for text. NOTE: You can also use the arrow keys to navigate the screen.

  10. Visual Interface VI Commands: Edit Tools xDeletes the character to the right of the cursor. nxDeletes the next n characters. dwDeletes the current word. ndwDeletes the next n words. ddDeletes the entire current line. nddDeletes the next n lines. uUndoes the last change. cwChanges word RReplaces text, switching to input mode so that the text you type replaces the text to the right of the cursor. yyorYCopies the current line to a buffer for later use. Deletes the line from the file. p Inserts the text deleted by the last yy or Y command.

  11. Visual Interface Practice Exercises • Using the VI Text Editor, create a file using your first name, followed by the number 88. (For example, joe88). • Add the following lines of text: • It was a dark night in the city. • Bad guys were lurking all around. • Save your file and exit VI.

  12. Visual Interface Practice Exercises • 2. Using the VI Text Editor, create a text file called file888. • Enter the following lines of text: • My new car is a better car than my old one. • This is the best thing I’ve ever done. • Save your file. • Add the following lines of text to the end of file888: • If all the big, ugly cars in the world • Were lined up end to end, • Some person would pull out and try to pass them all • Save your file and exit VI.

  13. Visual Interface Practice Exercises • 3. Open file888. Use vi commands to complete the following: • Replace the second line of text with the following: • Were lined up in a traffic jam in Los Angeles. • Delete the words big,uglyfrom the first line of text. • Delete the last line of text. • Undo the previous change. • Add the following line of text between the second and third lines: • And it was raining that night. • Save your file and exit VI.

  14. Visual Interface Practice Exercises • 4. Open file888. Use vi commands to complete the following: • Move to the end of the line, and then back to the beginning. • Move the cursor down 3 lines and to the right 4 characters. • Move to the beginning of the line and insert the following text: • I am using UNIX VI with ease. • Save your file and exit VI.

  15. Visual Interface Practice Exercises • 5. Open file888. Use vi commands to complete the following: • Search for the word ease. • Move to the beginning of the line. Move up 2 lines. • Delete the current line. • Use one command to delete a word. Then, undo the delete. • Move down 2 lines and delete several characters. • Exit from VI without saving your changes.

  16. Visual Interface Check Your Answers • viyourname88 • a.i(a or o is also correct) It was a dark night in the city.(ENTER)Bad guys were lurking all around. • b. Press ESC followed by :wqor ZZ • vi file888 • a. i(a or o is also correct) My new car is a better car than my old one.(ENTER)This is the best thing I’ve ever done. • b. Press ESC followed by :w • c. o(lower case) If all the big, ugly cars in the world(ENTER)Were lined up end to end,(ENTER)Some person would pull out and try to pass them all. • d. Press ESC followed by :wqor ZZ

  17. Visual Interface Check Your Answers • vi file888 • a. j RWere lined up in a traffic jam in Los Angeles. • b. Navigate to the beginning of the word big and press ESC followed by 3dw • c. Navigate to the last line and press ESC followed by dd • d. u • e. Shift+OAnd it was raining that night. • f. Press ESC followed by :wqor ZZ • vi file888 • a. $ 0(zero) • b. Use arrow keys • c. iI am using UNIX VI with ease. • d. Press ESC followed by :wqor ZZ

  18. Visual Interface Check Your Answers • vi file888 • a. /ease • b. 0(zero) kk • c. dd • d. dwfollowed by u • e. x • f. Press ESC followed by :q!

  19. This concludes Lesson 3: Visual Interface

More Related