Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)

Similar presentations


Presentation on theme: "Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)"— Presentation transcript:

1 Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)

2 Objectives Explain the basics of UNIX/Linux files, including ASCII, binary, and executable files Understand the types of editors Create and edit files using the vi editor ● Create and edit files using the Emacs editor

3 Understanding UNIX/Linux Files ● Almost everything you create in UNIX is stored in a file ● All information stored in files is in the form of binary digits – Binary digits are also known as bits – Bits have two states: 1 (on) and 0 (off) – 0’s and 1’s as a way to communicate with a computer is known as machine language

4 Understanding UNIX/Linux Files (continued) ● Machine language (or bit combinations) is translated into plain English using ASCII ● ASCII stands for American Standard Code for Information Interchange – ASCII uses a byte (a string of 8 bits) to represent keyboard characters such as letters and numbers – Text files contain printable, ASCII characters – Binary files contain nonprintable characters, or machine language

5

6 Executable Program Files ● Programmers develop source code as text files that are compiled before being executed ● Programmers also create scripts, which are files containing commands; scripts are interpreted ● Executable program files are compiled and interpreted files that can be run

7 Using Editors ● Editors let you create and edit ASCII files ● UNIX/Linux normally include two editors: vi and Emacs ● vi and Emacs are screen editors: they display the text you are editing one screen at a time

8 Using the Emacs Editor ● More complex than vi, but it is more consistent ● Not modal ● Supports a sophisticated, extensible macro language ● Reputed to have more features than any other UNIX/Linux program

9 Using the Emacs Editor (continued)

10

11 ● Creating a new file in Emacs – Type the Emacs command with the name of the new file after it at the command line, as: $ emacs filename & the & runs emacs in the background (leaves you the prompt) – [Alternate method] If you are using the GNOME interface, start Emacs by clicking the Main Menu icon, Applications -> Programming -> Emacs Text Editor

12 Using the Emacs Editor (continued) ● The menu bar at the top of the Emacs screen has categories for commands – File: Options for file operations – Edit: Text-editing functions – Options: Special options – Buffers: Access to storage buffers – Tools: Options for extra tool functionality – Help: Access to manuals and other help tools ● Note that most menu commands also list the keyboard version of the command ( File -> Open File: C-x C-f )

13 Using the Emacs Editor (continued) ● Editing an Emacs file – To navigate the cursor location, use the arrow keys, or Ctrl key combinations – Text is inserted by typing – Ctrl+x and then “u” is the undo command – You can cut, copy and paste text – There is a text search feature as well – Lets you format documents with word wrap

14 Reformatting a File Use the Alt+q command to turn on the word wrap feature in Emacs (Figure on page 147)

15 Chapter Summary ● Bytes are computer characters stored using numeric code (e.g., ASCII) ● The vi editor is a popular choice among UNIX/Linux users to edit text files ● Emacs editor – Popular alternative to vi – Has a powerful extensible command syntax – Navigate an Emacs file with cursor movement keys or Ctrl key combinations


Download ppt "Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)"

Similar presentations


Ads by Google