CS 497C - Introduction to UNIX Lecture 19: - The GNU emacs Editor Chin-Chih Chang chang@cs.twsu.edu Searching with Regular Expressions * If you can search for both michael and michel with this expression: mich*el. * You can also use a character class to specify a single character in that class. The pattern that matches both christie or christy should be christ[iy]e*. * You can use ^ and # to match an expression at the beginning and end of line, respectively. Searching with Regular Expressions * To search forward with regular expressions in an incremental manner, use [Ctrl-Alt-s] key sequence, type the regular expressions and then [Enter]. * To repeat a regular expression search, use [Ctrl-Alt-s][Enter][Enter]. Search and Replace * To globally replace the word Internet with World Wide Web without interaction, first press [Alt-x] and then enter the replace-string command. * This command completion feature can be done by using [Alt-x]repl[Tab]s[Tab]. First enter the string to be replaced and then enter the target string. Search and Replace * You can replace strings in an interactive manner with the query-replace facility. * The query-replace command is done by [Alt-%]. Then enter the string to be replaced and the target string. * Using Multiple Files, Windows and Buffers * To view the same file in two separate windows, use [Ctrl-x]2. * To move to the other window, the command is [Ctrl-x]o. * You can increase the window's vertical size by [Ctrl-x]^. * You can open different file by [Ctrl-x][Ctrl-f]. Using Multiple Files, Windows and Buffers * To replace current buffer, use [Ctrl-x][Ctrl-v]. * To close other windows, use [Ctrl-x]1. * To close the current window, use [Ctrl-x]0. * To call up another buffer, use [Ctrl-x]b. * You can insert a file into the current file by using [Ctrl-x]i filename. Escape to Shell * To escape to shell, use [Ctrl-x][Ctrl-z] or [Alt-x]shell. * Enter fg to return to emacs. * To execute a UNIX command, use [Alt-!]. * The help facility is invoked with [Ctrl-h]. * To access help by key, use [Ctrl-h]k and enter the key sequence. * To close the help window, use [Ctrl-x]1. Using the Help Facility [Ctrl-h] * To know what a command does, use [Ctrl-h]f (function) and enter the command. * To know the key binding, use [Ctrl-h]w (where-is) and enter the command. * To run the tutorial, use [Ctrl-h]t (tutorial). * To quit the tutorial, use [Ctrl-x]b to quit to the previous buffer. * To read the emacs documentation, use [Ctrl-h]i (information).