Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.

Similar presentations


Presentation on theme: "1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display."— Presentation transcript:

1 1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display the text you are creating (or editing) one screen at a time

2 2 Using the vi Editor Called vi because it is visual – it immediately displays on screen the changes that you make to text works in different modes –Insert mode - lets you enter text –Command mode - lets you enter commands to perform editing tasks

3 3 Using the vi Editor To create a new file in the vi editor, type vi and the name of the new file at the command prompt

4 4 Using the vi Editor When started, the vi editor is in command mode –In order to insert text, you must issue the “i” command to enter insert mode –Esc key will change vi from text mode to command mode –You can repeat the line just entered with the repeat command (.) –To edit what you’ve just typed, move the cursor with the various keyboard cursor movement keys

5 5 Using the vi Editor In insert mode, every character you type appears on the screen

6 6 Using the vi Editor The repeat command repeats the last insertion, or line. Now, edit the new line in order to create the next item

7 7 Using the vi Editor

8 8 Vi-Correcting text keys x Deletes the character specified by the cursor position dd Deletes the line specified by the cursor position u Undoes the most recent change U Undoes all the changes on the current line r Replaces a character that the cursor is on R Replaces characters starting from the cursor position, and changes vi to the text mode

9 9 Exit from vi editor Save - :w Save as different file - :w filename Save file and exit -- :wq filename Exit without saving file - :q!

10 10 practice

11 11 Using the vi Editor

12 12 Using the vi Editor Use the delete commands and the cursor movement keys to edit the text

13 13 Using the vi Editor

14 14 Using the vi Editor

15 15 Using the vi Editor The status line at the bottom of the screen displays information, including line- oriented commands and error messages

16 16 Using the vi Editor During text searches, you can replace, too. Use line-oriented commands in ex mode to perform this action

17 17 Using the vi Editor Saving a File and Exiting vi –You should always save the file before exiting vi, otherwise changes are lost –To save a file and continue working on it, type the :w (write) command –While in command mode, use the :wq (write and quit) command to save and exit iv, or the :zz command to exit after saving

18 18 Using the vi Editor In vi, you can also: –Add text from another file –Leave vi temporarily to perform other UNIX tasks, then return to your file –Change your display while editing, such as adding line numbering to help editing –Copy, cut, and paste text to help editing –Print text files –Cancel an editing session

19 19 Using the vi Editor

20 20 Using the vi Editor

21 21


Download ppt "1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display."

Similar presentations


Ads by Google