In the last class… The vi basics command, input and ex mode Input mode – entering and replacing text Saving text and quitting – the ex mode.

Slides:



Advertisements
Similar presentations
In the last Session… ls -l command seven fields nine permissions of a file ls -ld file ownership file permissions (three-tiered file protection system)
Advertisements

CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
EDIT MODE The HAAS Control Series PRESS THREE TIMES TO GET TO THIS PAGE (Continued on next slide) Note: SLIDE LEGEND ACTIONS INSTRUCTIONS KEYS INFORMATION.
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.
Program Development Tools IDE vs point tools Two tool flavors exist for developing embedded software: -IDEs: (Integrated Development Environments) i.e.,
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
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
Vi Editor TA for ITIS3100: Xu Fei
Chapter 5 Editing Text Files
CS 497C – Introduction to UNIX Lecture 10: The vi/vim Editor Chin-Chih Chang
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.
CS 497C – Introduction to UNIX Lecture 9: The vi/vim Editor Chin-Chih Chang
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.
Copyrights© 2008 BVU Amplify DITM Basics of OS,UNIX/LINUX and Shell programming Page:1 Lesson 3: Vi- editor By Simi By Simi.
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:
Chapter 3 Mastering Editors
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving vi Session Aborting Editing Session.
Introduction to Linux Instructor: Bennett M. Tanyag PART - 2.
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:
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 7 Editing.
Software I: Utilities and Internals Lecture 2 – The vi Text Editor * Modified from Dr. Robert Siegfried original presentation.
Introduction to Vim Robbie CSCI2100 Data Structures Tutorial 3.
Chapter8 The vi Editor. Introduction to vi u Modes of Operation u The Work Buffer  During the editing session, vi make all changes in the buffer  Advantage.
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.
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.
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.
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:
THE vi EDITOR. Introduction There are three editors available in almost all versions of Unix: ed, ex and vi. The ed program is the original editor that.
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.
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.
Basic VI Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
CS:414 introduction to Unix and Linux
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.
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
UNIT-2 Basic File Attributes Course code: 10CS44
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
Chapter 2 Basic vi Editor.
The Emacs Editor Read: Forouzan, Appendix C
TRIPLES.
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Presentation transcript:

In the last class… The vi basics command, input and ex mode Input mode – entering and replacing text Saving text and quitting – the ex mode

CONTENTS Navigation Editing text Undoing last editing instructions Repeating the last command Searching for a pattern Substitution – search and replace conclusion

NAVIGATION A command mode command doesn’t show up on screen but simply performs a function To move the cursor in four directions kmoves cursor up jmoves cursor down hmoves cursor left l moves cursor right

Word navigation bmoves back to beginning of word emoves forward to end of word wmoves forward to beginning word Example 5b takes the cursor 5 words back 3w takes the cursor 3 words forward

Moving to line extremes Moving to the beginning or end of a line To move to the first character of a line 0 or | 30| moves cursor to column 30 $ moves to the end of the current line The use of these commands along with b,e,w is allowed

Scrolling ctrl-fscrolls forward ctrl-bscrolls backward 10ctrl-fscroll 10 pages and navigate faster ctrl-dscrolls half page forward ctrl-uscrolls half page backward

Absolute movement The editor displays the total number of lines in the last line Ctrl-gto know the current line number 40Ggoes to line number 40 1Ggoes to line number 1 Ggoes to end of file

EDITING TEXT They use operators, such as, ddelete yyank (copy) dddelete entire line yycopy entire line 6dddeletes the current line and five lines below examples

Moving text (p) puts the text at the new location Copying text (y and p) yycopies current line 10yycopies current line & 9 lines below Joining lines (J) Jto join the current line and the line following it 4Jjoins following 3 lines with current line

UNDOING In command mode, to undo the last change made, we use u To discard all changes made to the current line, we useU

REPEATING THE LAST COMMAND The. (dot) command is used for repeating the last instruction in both editing and command mode commands Ex: 2dd deletes 2 lines from current line and to repeat this operation, type. (dot)

SEARCHING FOR A PATTERN / search forward ? search backward /printfthe search begins forward to position the cursor on the first instance of the word ?patternsearches backward for the most previous instance of the pattern nrepeats search in same direction of original search

SUBSTITUTION We can perform search and replace in ex mode using :s Its syntax is, :address/source_pattern/target_pattern/flags :1,$s/director/member/g :1,50s/unsigned//g :3,10s/director/member/g :.s/director/member/g :$s/director/member/g

CONCLUSION vi basics Input mode Saving text and quitting Navigation Ediying text Undoing, repeating last action Searching for a pattern Substitution

THANK YOU