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.

Slides:



Advertisements
Similar presentations
Course Outline: System Requirements What is Vi Editor Conventions
Advertisements

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.
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.
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.
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:
Basic Text Processing, Redirection and Pipes. 222 Lecture Overview  Basic text processing commands head, tail, wc  Redirection and pipes  Getting to.
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:
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.
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.
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.
Chapter 9 Using Text Editors. vi Editor visual Editor, ASCII text editor, no formatting capabilities almost as powerful as MS Word, has 26 clipboards.
1 © 2012 John Urrutia. All rights reserved. Chapter 6 The vi Editor.
Getting Started with Linux Linux System Administration Editors.
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.
PacNOG 6: Nadi, Fiji Editing, vi & Configuration Files Hervey Allen Network Startup Resource Center.
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
Editing, vi and Configuration Files Unix/IP Preparation Course May 29, 2011 Dar es Salaam, Tanzania
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
Editing, vi and Configuration Files Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
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.
Editing, vi and Configuration Files Unix/Linux Preparation Course June 27, 2010 Pago Pago, American Samoa
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.
Getting Started with Linux Linux System Administration Editors.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
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
Linux System Administration Editors
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
Emacs CSC 135.
Chapter 2 Basic vi Editor.
The Emacs Editor Read: Forouzan, Appendix C
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Presentation transcript:

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 you are editing. ▫Most commands to Vi move the cursor around the file. ▫Faster (than pico) for those who can type ▫Available standard on most Unix systems

Vi Editor Starting the Vi editor ▫vi lets you create new files or edit existing files. ▫Command to start Vi : vi ▫Open existing (or create new) file in vi: vi example1

Vi Editor Modes of Operation ▫Command Mode Allows the entry of commands to manipulate text Commands are usually one or two characters long ▫Insert Mode Puts anything you type on the keyboard into the current file

Vi Editor Modes of Operation ▫Command Mode Allows the entry of commands to manipulate text Commands are usually one or two characters long ▫Insert Mode Puts anything you type on the keyboard into the current file

Vi Editor Vi starts in command mode by default Most commonly used commands to get into insert mode are a and i Once in insert mode, you get out of it by hitting the Esc key

Vi Editor From within vi: Hit i key to enter edit Insert Mode Type This is EASY. Then hit the escape key, for Command Mode

Vi Editor Saving files and exiting the Vi editor ▫:q Quit the editor ▫:q! Quit the editor without saving the changes to the file. ▫:w Save the file you are editing ▫ZZ The editing buffer is written to the file only if any changes were made. ▫:wq :- Same effect as ZZ

To ensure you are in command mode: Hit the Esc key twice. To save your file: Type :w to write (save) the file. To save your file under a different name: Type :w example2 To save your file and quite: Type :wq

Vi Editor How to type commands in command mode [count] command [where] count : Its a number where : Specifies how many lines or how much of the document the command affects. It can also be any command that moves the cursor.

Vi Editor Moving from Command to Insert Mode ▫a Enter insert mode; the characters typed will be inserted after the current cursor position. If a count is specified, then the inserted text will be repeated that many times ▫i Enter insert mode, the characters typed will be inserted before the current cursor position. If a count is specified, the inserted text will be repeated that many times o Enter insert mode; will start a new line beneath current line.

Vi Editor Moving the cursor, in Command Mode hmove cursor to the left lmove cursor to the right jmove cursor up kmove cursor down Use vi to edit example2 to have these 2 lines: This is not hard. This is VERY easy. This is not hard at all.

Vi Editor Some simple Vi Commands ▫r replace one character under the cursor. Specify count to replace that many characters. ▫R Starting from the current cursor position, replace the characters with the one typed on the keyboard ▫x Delete character under the cursor. Count specifies how many characters to delete Practice these commands to further edit example2

Vi Editor Cutting text  d^ Deletes from current cursor position to the beginning of the line  d$ Deletes from current cursor position to the end of the line  Dw Deletes from current cursor position to the end of the word  dd Deletes one line from current cursor position. Specify count to delete many lines.

Vi Editor Yanking and Pasting  yl yank a single character. Specify count to yank more characters  yw yank a single word. Specify count to yank more words  yy yank a single line. Specify count to yank more lines  p paste the text that was either deleted or yanked previously mmark the current line

Practice Yanking, Deleting, and Pasting Lines of Text Use vi to create a new file: example3, with these lines: One Two Three Four Five Six Seven Eight Nine ten Then, from command mode, enter :wq to save the file

Vi Editor To go to a specific line in the file :linenumber To go to the last line in the file :G String Search ▫/[pattern] : search forward for the pattern ▫?[pattern] : search backward for the pattern To undo the last command: ▫u

More practice Use vi to edit existing file: example3 …