CS 497C - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

CS 497C

Description:

The program was originally written as a set of macros for the TECO editor. ... GNU emacs is more than an editor; it handles a number of non-editing functions. ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 13
Provided by: Kindy
Category:
Tags: 497c | keys

less

Transcript and Presenter's Notes

Title: CS 497C


1
CS 497C Introduction to UNIXLecture 17 - The
GNU emacs Editor
  • Chin-Chih Changchang_at_cs.twsu.edu

2
The GNU emacs Editor
  • emacs was create by Richard Stallman (the founder
    of GNU, now the Free Software Foundation).
  • The program was originally written as a set of
    macros for the TECO editor.
  • emacs is not available in all UNIX systems but is
    standard on Linux.
  • GNU emacs is more than an editor it handles a
    number of non-editing functions.

3
The GNU emacs Editor
  • vi often does things with fewer keystrokes, but
    emacs easily surpass vi when it comes to
    searching and replacing and using macros.
  • After invoking emacs, you have a full screen. 22
    of the 25 lines are available for editing.

4
The GNU emacs Editor
  • The top one in reverse video shows a menu, the
    lower one in reverse video shows the mode line,
    and the bottom line is the minibuffer showing an
    emacs-generated message.
  • In the mode line you can see the filename and the
    cursor position (L1).
  • Like most word processors unlike vi, emacs is a
    mode-less editor.

5
emacs Preliminaries
  • In the emacs documentation, key sequences
    described as
  • C-e This is Ctrl-e.
  • C-x C-b This is Ctrl-xCtrl-b.
  • C-x b This is Ctrl-xb.
  • M-e This is Meta-e.
  • On the PC, you can use the Alt key or
    Esc-release to substitute Meta key.

6
emacs Preliminaries
  • When you press a valid key sequence, emacs
    executes a command associated with the key.
  • For instance, when you press Ctrl-n, emacs
    executes the next-line command.
  • To canceling a sequence, use Ctrl-g.
  • emacs reads the file .emacs at startup. emacs q
    ignores the .emacs file at startup.
  • Use Ctrl-xCtrl-c to quit emacs.

7
Inserting and Replacing Text
  • The default input mode is the insert mode. To
    switch to the overwrite mode, press the Insert
    key or enter the overwrite-mode command which can
    be done by the key sequence Alt-xovtab.
  • To enter a control character, first enter
    Ctrl-q and then the control character.
  • To save a file, use Ctrl-x Ctrl-s.
  • To save a file as a different filename, use
    Ctrl-xCtrl-w.

8
Saving Text
  • To open a different file, use Ctrl-xCtrl-f.
  • emacs has an autosave feature which automatically
    saves a copy of the buffer in filename.
  • To recover from the crash, use the recover-file
    command
  • Alt-xrecover-file

9
The Digital Argument
  • To perform a command as many times, use the
    digital argument. The number is prefixed by the
    Meta (Alt on PC) key.
  • For example, to delete 5 characters, use
    Meta-5Ctrl-d.
  • The other way is to use the universal argument
    Ctrl-u such as
  • Ctrl-u5Ctrl-d.

10
Navigation
  • emacs uses the control keys to move in the four
    directions. These keys are quite intuitive b
    (back), f (forward), p (previous line) and n
    (next line).
  • Ctrl-b move left, Ctrl-f move right,
    Ctrl-p move up, Ctrl-n move down.
  • To scroll full page forward, use Ctrl-v. To
    scroll full page backward, use Alt-v.
  • To redraw the screen and position cursor at
    center of screen, use Ctrl-l.

11
Navigation
  • To move to the beginning of a line, use Ctrl-a.
    To move the end of a line, use Ctrl-e.
  • To move the beginning of the word, use Alt-f.
    To move the end of the word, use Alt-b.
  • To move the specified line number, use Alt-x
    goto-line Enter and then type the line number.

12
Working with Regions
  • To move to the beginning of the file, use
    Alt-lt. To move to the end of the file, use
    Alt-gt.
  • To mark a region, first move the cursor to the
    beginning of the section and use Ctrl-Spacebar
    or Ctrl-_at_ and then move the cursor to the end
    of the section.
  • You can use Ctrl-xCtrl-x to toggle between
    two ends.
Write a Comment
User Comments (0)
About PowerShow.com