The Emacs Editor Read: Forouzan, Appendix C

Slides:



Advertisements
Similar presentations
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Advertisements

A Guide to Unix Using Linux Fourth Edition
Editing with vi Or more fun than you thought you’d have without a mouse Prof. Chris GauthierDickey.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
CS 497C – Introduction to UNIX Lecture 17: - The GNU emacs Editor Chin-Chih Chang
Vi Editor TA for ITIS3100: Xu Fei
Chapter 5 Editing Text Files
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.
Starting Vi Opening an existing file vi filename Creating a new file vi filename In your workshop directory, create a new file called mysong vi mysong.
CS465 - UNIX The vi Editor. Creating Files Most human-readable files on Unix are created with a text editor Unix has many, many different editors ed a.
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
1 Unix Editors (ee, ed, ex, vi, vim) and Compilers (g77, gcc) Speaker: Li-Wen Chen Date:
1 Unix Text Editors Creating files on the Unix system.
Chapter 3 Mastering Editors
Get to Know Your Keyboard. Operational Keys Escape (Esc) – allows you to exit unwanted menus and dialog boxes Tab – used to indent; moves the cursor 5.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
T HE VI EDITOR. vi has 2 modes: command mode (initial or "default" mode) insert mode [Esc] is used to switch to command mode. In general, vi commands:
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
Introduction to Vim Robbie CSCI2100 Data Structures Tutorial 3.
1 © 2014 John Urrutia. All rights reserved. Chapter 7 The “ Emacs “ Editor.
UNIX Intro vi  vi is the standard UNIX text editor v Contents 1.Why use vi ? 2. vi Basics 3.Moving Around 4.Inserting Text.
4 Editing files and Emacs Editing files The Emacs editor.
Chapter 5 Editing Text Files. Basic Concept A text editor works on a file buffer that is a memory copy of a disk file The disk file is not updated until.
Text editors Why should I use an editor ? It is very important to able to use at least one text mode editor a text mode editor is so useful on remote machines.
Basic vi Commands Michael Davis Phd Student, Atmospheric Science.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Tony Kombol.  Why text edit?  Many programs and features require configuration ▪ Configuration is kept in files ▪ Usually in the /etc directory  Changes.
Unix Session IV.
Introduction to Unix – CS 21 Lecture 7. Lecture Overview Regular expressions revisited emacs versus vi Basic emacs and vi usage.
Text Editing February 2 nd, 2004 Class Meeting 3.
1 of 47 Chapter 4: The vi Editor – First Look Copyright ©2008 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved.
Chapter Three Text Editing1 System Programming Text Editing.
VI EDITOR University of Mississippi. Vi Editor What is Vi ? ▫Vi is a screen based editor. ▫The screen of your terminal will act as a window into the file.
Chapter 9 Using Text Editors. vi Editor visual Editor, ASCII text editor, no formatting capabilities almost as powerful as MS Word, has 26 clipboards.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Lesson 4-Mastering the Visual Editor. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating.
Chapter Three The UNIX Editors.
Linux Class #03. File Access Permissions Types of users in Linux: Local User (u) Group User (g) Other User (o) Each User can have 3 types of permissions:
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Word Lesson 2 Basic Editing
Text editing and more basic commands CS 2204 Class meeting 3 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session.
Agenda Using vi Editor Starting vi Session Command / Input Modes
Vi editor Pronounced: `vee eye‘’. Agenda Describe the background of vi Editor Use vi editor to: create text files edit text files Our Goal is to create.
1 Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Basic VI Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
CS:414 introduction to Unix and Linux
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Presentation By:- Komal Sadhwani
Vim basics Vi IMproved.
Guide To UNIX Using Linux Third Edition
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vim.
Vi Introduction Tony Kombol.
Linux 104 Training Module File Editing.
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Linux System Administration Editors
Technical University of Kosice
Document Processing Part 2
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
CREATING, PRINTING, AND EDITING DOCUMENTS
You do want to create and edit programs?
vim Basics Understanding And Using the vim Text Editor
Emacs CSC 135.
Linux Operations and Administration
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
Presentation transcript:

The Emacs Editor Read: Forouzan, Appendix C

emacs (1) Emacs: (Editor MACroS) developed by Richard Stallman and James Gosling amongst many others modeless has versions for Unix, Windows, and other systems menu-driven and mouse-driven under X-windows. Emacs uses special keys (ESC and CTRL) to perform editor functions other than input This editor can do everything Contains a complete programming language (a LISP interpretter) which can be used to write functions for use in the editor

emacs (2) Key combination: a sequence of (special) keys C-x "Control X" Hold down Control key while typing x. C-x C-c Hold down Control key while typing x and c. Or hold down control key while typing x, then release, then hold down control while typing c. C-x u Hold down the Control key, keep it down while typing x. Release the Control key and type u. ESC x "Escape x" or "Meta x" What always works: Type the Escape key. Release. Type x. What sometimes works (and is convenient): Hold down the Alt key and x key at the same time

emacs (3) Starting Emacs on a file: The following happen: terra[23]% emacs myfile myfile is either a new or existing filename. The following happen: If the filename you typed was an existing file, you will see the first page of the file on your screen. If you typed a new filename, you will be faced with a blank screen, and you may type the file. The file name will appear at the bottom of the screen.

emacs (4) When you encounter problems ... Emacs is a very powerful editor No matter what key combination you press, it probably does something! Sometimes it does something you didn't want! UNDO To undo last operation: Ctrl-_ (Control & underscore) You can also use: Ctrl-x u Can be repeated to keep undoing operations Cancel If you get to a mode which you don't want e.g: you typed Ctrl-x and emacs expects more Type Ctrl-g It will usually back you out of almost anything

emacs (5) Cursor Movement Other Movements: Arrow keys move the cursor around screen. Alternatively, use: Ctrl-f Forward a character (Right) Ctrl-b Back a character (Left) Ctrl-n Next line (Down) Ctrl-p Previous line (Up) Other Movements: Ctrl-a Beginning of line. Ctrl-e End of line. Ctrl-v View next screen. ESC v View previous screen. ESC < Start of file. ESC > End of file. ESC f Forward a word. ESC b Back a word. ESC x goto-line Goes to a given line number.

emacs (6) Cut and Paste To move a block of text Text Deletion Move cursor to start of block Ctrl-@ Set mark Move cursor to end of block. Ctrl-w Wipe out (Cut) ESC w Copy. Move cursor to new location Ctrl-y Yank back last thing killed (Paste). The Ctrl-y may be repeated for multiple copies. Text Deletion Backspace Kill character before cursor C-k Kill line - deletes to end of line. C-d Delete character at cursor ESC d Delete next word. C-x u Undo last change. Repeat to undo as many changes as you wish. ESC x revert-buffer Undo all changes since last save.

emacs (7) Save / Exit Emacs creates extra files. Other Commands Ctrl-x Ctrl-s Save file (over-write original) Ctrl-x Ctrl-c Exit from emacs. Ctrl-x Ctrl-w Save in different file You are prompted for name Emacs creates extra files. When you save using Ctrl-x Ctrl-s, the old file will be kept as filename~. If you exit without saving, the modified unsaved file will be saved as #filename#. Other Commands Check spelling Type ESC $ Check spelling of 1 word. ESC x spell-buffer or ESC x ispell-buffer Check spelling of file. Insert a file Ctrl-x i Insert a file at current cursor position. Reformat regions ESC q Reformat paragraph To reformat a region: Move cursor to start of block. Ctrl-@ Move cursor to end of block. ESC q

emacs (8) Searching Search and Replace Search allows you to search for a string Search from the cursor position to the end of file. To search for a string, type Ctrl-s string Ctrl-s again repeats Ctrl-g to quit Search and Replace Replace all occurrences of one string with another ESC x replace-string you are prompted for the replacement text Query-replace asks before replacing each occurrence. Type: ESC % you are prompted for search & replace strings. At each occurrence, respond: y/n to replace/not replace. ! to replace all remaining ESC to exit ? for lots more options

Exercise 1 Use vi or emacs to edit a .plan file in your “home directory”. finger your_usr_name Or /usr/bin/finger –l your_usr_name