4 Editing files and Emacs Editing files The Emacs editor.

Slides:



Advertisements
Similar presentations
CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
Advertisements

Microsoft Word 2010 Lesson 1 Word Lesson 1 presentation prepared by Kathy Clark (Southside H.S. IT Academy Teacher at Chocowinity, NC). Content from Microsoft.
 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.
A Guide to Unix Using Linux Fourth Edition
Chapter 2 Creating a Research Paper with Citations and References
Editing with vi Or more fun than you thought you’d have without a mouse Prof. Chris GauthierDickey.
THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
CS 497C – Introduction to UNIX Lecture 17: - The GNU emacs Editor Chin-Chih Chang
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.
Web Page: // The Windows XP Textbook by Stewart Venit Standard Edition.
CS 497C – Introduction to UNIX Lecture 9: The vi/vim Editor Chin-Chih Chang
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.
Key Applications Module Lesson 12 — Word Essentials
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.
Word Tutorial 1 Creating a document.
1 Unix Text Editors Creating files on the Unix system.
謝耀偉編著 國立高雄大學應用數學系 Living in Emacs DeveloperWorks, IBM.
Chapter 3 Mastering Editors
Hong Kong Taoist Association Wun Tsuen School Computer Studies Microsoft Word 2010.
Chapter 2 Creating a Research Paper with References and Sources Microsoft Word 2013.
MICROSOFT WORD GETTING STARTED WITH WORD. CONTENTS 1.STARTING THE PROGRAMSTARTING THE PROGRAM 2.BASIC TEXT EDITINGBASIC TEXT EDITING 3.SAVING A DOCUMENTSAVING.
EMACS To quote the Emacs Manual: Emacs is the extensible, customizable, self- documenting real-time display editor. Emacs is an editor for plain-text,
Return to the Word 2007 web page Lesson 2: Creating and Editing Business Letters.
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:
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
Information Technology Word Processing. Word Processing is the preparation of documents such as letters, reports, memos, books, or any other type of correspondences.
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.
Basic Computer and Word Functions, part 1 Read the information and use to answer the questions in the Basic Computer and Word Functions Study Guide.
1 © 2014 John Urrutia. All rights reserved. Chapter 7 The “ Emacs “ Editor.
Introduction to Unix – CS 21 Lecture 8. Lecture Overview More detail on emacs and vi Regular expression matching in emacs and vi.
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.
Computer Skills /1436 Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Place photo here 1.
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.
Unix Session IV.
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.
1 © 2012 John Urrutia. All rights reserved. Chapter 6 The vi Editor.
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:
Lesson 1 - Understanding the Word Window and Creating a New Document
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
1. Chapter 1 Creating, Printing, and Editing Documents.
THE UNIX SYSTEM Jan Recitation 2 Introduction to Networking.
1 Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008 Chapter 6: The vi Editor – Last Look 1 of 55 Copyright ©2008 by Pearson Education, Inc. Upper Saddle.
Introduction to Emacs (a Unix, Linux, and Windows text editor)
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
1 Word Processing Intermediate Using Microsoft Office 2000.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
Guide To UNIX Using Linux Third Edition
Fastest way for already created documents
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
CREATING, PRINTING, AND EDITING DOCUMENTS
Emacs CSC 135.
Chapter 2 Basic vi Editor.
European Computer Driving Licence
The Emacs Editor Read: Forouzan, Appendix C
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
TERMS AND CONDITIONS   These PowerPoint slides are a tool for lecturers, and as such: YOU MAY add content to the slides, delete content from the slides,
Presentation transcript:

4 Editing files and Emacs Editing files The Emacs editor

Editors  Editors are used to create files of text and to modify their contents  You need an editor for sending , writing programs and many other tasks  There are many different editors - vi, ed and emacs are common UNIX examples  There are different styles of editor - e.g. line editors and text editors  They are not the same as word processors which are concerned with printed documents (fonts, sizes, etc.)

The Emacs Editor  A powerful editor, available on most UNIX systems  It’s a text editor  Complex and extensible - we will only explore a fraction - see tutorial and on-line help facilities for more

Emacs conventions  Frequent use of the control and meta keys  control key usually marked control or ctrl  the meta key is usually marked alt  The notation C-x means hold down the control key and simultaneously press the x key (was ^X in previous lectures)  M-y means hold down the meta (alt) key and simultaneously press the y key  If the alt-y combination is taken by the host operating system (for example Windows), you can press the escape (esc) key, release it, and then press the y key

Mini-buffer Status line Edit window

Starting and quitting  From the UNIX prompt type emacs or emacs filename  The emacs screen is divided into three parts  edit window - large part where the contents of the file are displayed  status line - name of file, how far through you are and whether it needs saving  minibuffer - where commands are entered  C-x C-c to quit (of course). You may be prompted to save files

Moving around the file  Your current position in the file is shown by the cursor  Most basic movement is one character or line at a time  use the arrow keys or  C-bbackward (left) one character  C-fforward (right) one character  C-pprevious line (up one character)  C-nnext line (down one character)  Scrolling happens as necessary

 Can also move in steps of a word, sentence, paragraphs and screen  M-fforwards one word  M-bbackwards one word  C-astart of current line  C-eend of current line  M-astart of current sentence  M-eend of current sentence  C-v scroll down one screen  M-vscroll up one screen  M-<move to start of file  M->move to end of file  C-l refreshes the screen and centers the cursor.

Inserting and deleting text  To insert text, position the cursor and type  Type RETURN to enter a new line, otherwise the line will wrap around  DEL deletes the character before the cursor and C-d the character after the cursor. Hold down for repeated operation  M-del and M-d deletes whole words

 C-k deletes from cursor to end of line. A further C-k deletes the new line character  Mark and then delete a whole area:  C-SPACE at start and move cursor to end.  Make sure you have “Active Region Highlighting” ticked to see the marked region in color!  C-w to delete the marked out region  M-w copies the area without deleting it.  Commands that remove more than one character at a time save the text. It can be yanked back with C-y  Another C-y to yank back another copy  M-y to yank back next previously deleted text  Can use C-w and C-y to move text around

File handling  Need to be able to load and save files  C-x C-f finds and loads a file  Prompts for the pathname in the minibuffer  Type the name and press RETURN  Use TAB for filename completion  File is either loaded or created

 Changes made on screen are not immediately made to the file, they are made to a copy called the buffer  Have to explicitly write them back by saving, C-x s (all files) C-x C-s (current file) (answer y and n to prompts)  Can have more than one file open at a time. C-x C-f also switches between buffers if we give the name of an open buffer.  C-x b swaps to the previous buffer  Save frequently - work will be lost if emacs or the system crashes  Previous version may be backed up in filename~

Undoing mistakes  C-x u, C-_, and C-/ undo the previous command  Repeating the undo command takes you further back through the editing history

Searching  Need to search for text in a large file  Incremental search  type C-s to search forward.  Type C-r to search backwards  Or enter command M-x isearch-forward or M-x isearch-backwards in the minibuffer (use TAB for command completion)  you can delete the last character in the search string  C-g to quit at any time (this works for any command!)

Replacing strings  Change all occurrences of one string of text with another  type M-x and enter query-replace  Or type M-%  enter search and target strings  type y or n at each prompt. ! to replace all  use replace-string to avoid the prompting  M-x then spell-buffer for the spell checker

Windows  Can divide the edit window into smaller sub-windows, each with a different document  C-x 2 split horizontally  C-x 3split vertically  C-x 1make current window the full window  C-x omove cursor to the next window

Modes  Modes configure emacs for different kinds of editing, controlling wrap- around and indenting  M-x then mode name  fundamental-mode  text-mode (gives automatic text wrapping)  c++-mode  May guess mode from the filename suffix  Use TAB for autocompletion

Help and the tutorial  C-h for top level help menu  C-h C-h to find out what each menu option means  C-h t for the on-line tutorial  A cheatsheet with most of the key combinations in this lecture is in the module folder

Coursework 1  Deadline: 10th April 4PM.  Covers the first three lectures (and the revision lecture)  It mentions one simple command we haven’t seen. You’ll have to find out how it works.

Next Lecture  UNIX processes  How to list them  How to prioritise them  How to schedule them  Parent and Child processes  Signals  What are they for?  Types of signal