CS 497C – Introduction to UNIX Lecture 18: - The GNU emacs Editor Chin-Chih Chang
Published byModified over 6 years ago
Presentation on theme: "CS 497C – Introduction to UNIX Lecture 18: - The GNU emacs Editor Chin-Chih Chang"— Presentation transcript:
CS 497C – Introduction to UNIX Lecture 18: - The GNU emacs Editor Chin-Chih Chang firstname.lastname@example.org email@example.com
Deleting, Moving and Copying Text To delete a character, use [Ctrl-d]. To delete a word, use [Alt-d]. To delete text from the current cursor position to the end of line, use [Ctrl-k]. To delete the entire line, first use [Ctrl-a] and then [Ctrl-k][Ctrl-k]. To delete text in a region, first mark the region and then use [Ctrl-w].
Deleting, Moving and Copying Text [Ctrl-y] is universally used to restore text from the deletion. While [Ctrl-w] deletes text in a region, the command to copy text is [Alt-w]. You can transpose two adjacent characters by using [Ctrl-t].
Changing Case of Text To convert an entire word to uppercase, move to the beginning of the word and then press [Alt-u]. You use [Alt-u] for converting a word to lowercase. To capitalize a single character, position the cursor under it and then use [Alt-c].
Changing Case of Text and Command Completion For transforming case in large blocks of text, use a region. The commands to convert text in a region are: [Ctrl-x][Ctrl-u] and [Ctrl-x][Ctrl-l]. The command completion feature can reduce some of the typing work. The guiding principle here is this: Enter as much of the command text as you want and then press the [Tab] key.
Undoing and Redoing Editing To undo the change, there are three ways: [Ctrl-x]u, [Ctrl-_], [Ctrl--]. If you continue to press [Ctrl--], you’ll undo the changes made before the last save. If you keep pressing [Ctrl--], emacs starts redoing everything that you have undone.
String Search The incremental and non-incremental search techniques are used in string search in emacs. Incremental search is invoked with [Ctrl-s] followed by the search string. After entering [Ctrl-s] emacs prompts for the search string in the minibuffer. Suppose you’re looking for mail. After m is entered, the search starts immediately.
String Search The cursor relocates itself at the first instance of m – maybe on the word moon. After mail is entered, press [Enter]. There are a number of advantages of using incremental search: –The search is faster. –emacs tells you instantly whether the string exists in the file. –If there is a typo, backspacing erases the error.
String Search At the end of a file, use [Ctrl-r] instead of [Ctrl-s]. To repeat a search, you’ll have to use the same command – [Ctrl-s] or [Ctrl-r]. In non-incremental search just press [Enter] and then type the string. Like vi, emacs uses a pattern comprising some special characters to look for similar strings. This pattern is called a regular expression.